The Tech World..!!
C Program for Swapping of 2 Numbers using Bitwise Operator
#include<stdio.h>
int main()
{
int a, b ;
printf("Enter 2 Numbers \n");
scanf("%d \t %d",&a,&b);
a = a ^ b ;
b = a ^ b ;
a = b ^ a ;
printf("The swapped Numbers are ");
printf("a = %d \t b= %d \n",a,b);
return 0;
}
Older Posts
Home
Subscribe to:
Posts (Atom)