Write a program for swapping two numbers with the help
of TEMP.
#include <iostream.h>
#include <conio.h>
void main()
{
int a,b, temp;
cout<<"Enter value for a: ";
cin>>a;
cout<<"Enter value for b: ";
cin>>b;
temp=a;
a=b;
b=temp;
cout<<"Value of a: "
<<a<<"Value of b: "<<b;
getch();
}
No comments:
Post a Comment