2dix-The Student Choice
Log in Register now

c++ Program of SWAPING TWO VARIABLES WITHOUT USING THIRD VARIABLE

Write a Program of SWAPING TWO VARIABLES WITHOUT USING THIRD VARIABLE

#include<iostream.h> 
#include<conio.h> 

void main()
{
int a,b;
clrscr();
printf("\nEnter two numbers:");
scanf("%d %d",&a,&b);
printf("\nBefore swapping a=%d b=%d",a,b);
a=a^b;
b=b^a;
a=a^b;
printf("\nAfter swapping a=%d b=%d",a,b);
getch();
}


Note:    
           If you want to change in this program please write through the comment on this page. you can also past similar program of 
             c++ with output.your comment is valuable to the other user and person.

comments (1)

avatar