Tuesday, August 4, 2009

swapping without third variable and single line

main()
{
int a=15,b=5;
clrscr();
a=(a+b)-(b=(a+b)-b);
printf("a=%d b= %d",a,b);
getch();
}

output: a=5 b=10

No comments:

Post a Comment