Showing posts with label Multiply and swap 2 nmbers using bitwise operators. Show all posts
Showing posts with label Multiply and swap 2 nmbers using bitwise operators. Show all posts

Multiply and swap 2 nmbers using bitwise operators



#include<stdio.h>
#include<conio.h>
void main(void)
{
int a,b;
clrscr();
printf("Input value of A: ");
scanf("%d",&a);
printf("Input value of B: ");
scanf("%d",&b);
a=a^b;
b=b^a;
a=b^a;
printf("After Swapping:\n");
printf("Value of A: %d",a);
printf("\nValue of B: %d",b);
getch();
}

Labels