j

Saturday, 7 November 2015

Write a program that take valuse of a and b then enterchange their values without using extra variable

PROGRAM SOLUTION

#include<iostream.h>
#include<conio.h>
void mian()
{
clrscr();
int a,b;
cout<<"Enter the value of a and b :: ";
cin>>a>>b;
cout<<"The value of a before change :: "<<a<<endl;
cout<<"The value of b before change :: "<<b<<endl;
a=a+b;
b=a-b;
a=a-b;
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 :