Program to Swap two Values A & B Without Using third Variable

#include<stdio.h>
#include<conio.h>
void main()
{
  clrscr();
  int a,b;
   printf("\n enter number a:");
   scanf("\n %d",&a);
   printf("\n enter number b:");
   scanf("\n %d",&b);

   a=a+b;
   b=a-b;
   a=a-b;

   printf("\n reslut a:=%d",a);
   printf("\n result b:=%d",b);
     getch();
}

One response on “Program to Swap two Values A & B Without Using third Variable

  1. Ajeetvikash

    Please send programme for swap 4 numbers without using other variables

Leave a Reply