Saturday 10 December 2011

a program to Exchange to value without use third variable in c

#include
#include
main()
{
int a,b;
clrscr();
printf("\n ENTER VALUE A:-");
scanf("%d",&a);
printf("\n ENTER VALUE B:-");
scanf("%d",&b);
a=a+b;
b=a-b;
a=a-b;
printf("\n a=%d,b=%d",a,b);
getch();
}


OUTPUT
ENTER VALUE A:10
ENTER VALUE B:15
A=15,B=10

No comments:

Post a Comment