C program for swapping 2 numbers with and without temp variables
#include<stdio.h>#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("Enter two nos.:-");
scanf("%d%d",&a,&b);
printf("Before swapping value of a=%d, & value of b=%d\n",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("After swapping value of a=%d, & value of b=%d",a,b);
getch();
}
0 Comments