C Program to swap two numbers without using third variable
Advertisement
swap.c
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include<stdio.h> #include<conio.h> void main() { int a,b; clrscr(); printf("\n enter the value of a and b :"); scanf("%d %d",&a,&b); a=a+b; b=a-b; a=a-b; printf("swapping of a=%d",a); printf("swapping of b=%d",b); getch(); } |