Friday, October 25, 2013
Home »
C Plus Plus Program to Swap Values of Two Variables
» Program to Swap Values of Two Variables
Program to Swap Values of Two Variables
#include<iostream.h>
#include<conio.h>
void main()
{
int v1, v2, temp;
cout<<"Enter value of first variable:";
cin>>v1;
cout<<"Enter value of second variable:";
cin>>v2;
cout<<"The values before swapping are: \n Varible 1="<<v1<<" Variable 2="<<v2;
temp = v1;
v1 = v2;
v2 = temp;
cout<<"\n The values after swapping are: \n Varible 1="<<v1<<" Variable 2="<<v2;
getch();
}
Nice program. Check Swap two variable values without third
ReplyDelete