write a program to exchange value of two variable without the help of a 3rd variable. (use function ) c++
Answers
Answered by
0
Answer:
#include<iostream>
using namespace std;
void swap(int ,int );
//Call By Value
int main()
{
int a,b;
cout<<"\nEnter Two Number You Want To Swap \n";
cin>>a>>b;
cout<<"\nAfter Swapping Numbers Are Given below\n\n";
swap(a,b);
return 0;
}
void swap(int x,int y)
{
int z;
z=x;
x=y;
y=z;
cout<<x<<" "<<y<<" \n";
}
Similar questions