Bhuvan InfoTech Android App

Download our Android App and browse Technical News, Projects, Computer Tricks more easily with lots of Interesting Features.

Tuesday, June 14, 2016

Swap two variables using XOR | C program

#include<stdio.h>

int main()
{
 int a,b;
 printf("Enter 1st Variable : ");
 scanf("%d",&a);
 printf("\nEnter 2nd Variable : ");
 scanf("%i",&b);
  a ^= b;
  b ^= a;
  a ^= b;

 printf("A : %d",a);
 printf("\nB : %d",b);
 return 0;
}
Bhuvan Arora

No comments:

Amazing Deal !