Monday, January 4, 2010

Program to show swap of two no’s without using third variable.


#include
#include

void main()
{
int a,b;
clrscr();
printf("enter value for a & b: ");
scanf("%d%d",&a,&b);
a=a+b;
b=a-b;
a=a-b;
printf("after swapping the value of a & b: %d %d",a,b);
getch();
}

No comments:

Post a Comment