Swapping Without Using Third Variable
#include<stdio.h>
#include<conio.h>
int main()
{
int a, b;
printf("Enter Two Numbers:- ");
scanf("%d%d",&a,&b);
a=a+b;
b=a-b;
a=a-b;
printf("\nAfter swap a=%d b=%d",a,b);
return 0;
}
Output:-
Enter Two Numbers:- 2
3
After swap a=3 b=2
Comments
Post a Comment