swap two numbers without using a temporary variable …

0
7742

C Program to swap two numbers without using third variable with programming examples for beginners and professionals covering concepts, control statements, c array, c pointers, c structures, union, c strings and more.

swap.c

#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();
}