j

Saturday, 7 November 2015

Write a program that take values of a and b than enterchange their values

Program Solution

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,temp;
cout<<"Enter the values a and b ::";
cin>>a>>b;
cout<<"The value of a before change :: "<<a<<endl;
cout<<"The value of b before change :: "<<b<<endl;
temp=a;
a=b;
b=temp;
cout<<"The value of a after change :: "<<a<<endl;
cout<<"The value of b after change :: "<<b<<endl;
getch();
}

Output

Subscribe to this Blog via Email :