skip to main |
skip to sidebar
Swaping Using Bit Wise Operator
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("enter the value of a&b");
scanf("%d%d",&a,&b);
a=a^b;
b=a^b;
a=a^b;
printf("a=%d\nb=%d",a,b);
getch();
}
OUTPUT:
enter the value of a&b
2
3
a=3
b=2
No comments:
Post a Comment