Write a program in C to multiply and swap two numbers 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();
}
Post a Comment