C Programming
Write a C program to input two nos and swap it without using third variable.
void main()
{ int a,b;
printf("Enter two nos.");
scanf("%d%d",&a,&b);
printf("Before Swaped value a=%db=%d",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("Swaped value a=%db=%d",a,b);
getch();
}
Input: 10 20
C Programming{ int a,b;
printf("Enter two nos.");
scanf("%d%d",&a,&b);
printf("Before Swaped value a=%db=%d",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("Swaped value a=%db=%d",a,b);
getch();
}