Welcome to Bitwise operators.  

Do the following operations using Bitwise operators:


Input-output format:  
Input consists of unsigned integers  
Refer sample Input Output for output format.  

Sample Input and Output:  
AND  
Enter a and b  
7
4  
aANDb = 4  

OR  
Enter a and b  
3
4  
aORb = 7  

XOR  
Enter a and b  
4
2  
aXORb = 6  



Program Code:
#include<stdio.h>
int main()
{
int a, b;
printf("AND\n");
printf("Enter a and b\n");
scanf("%d", &a);
scanf("%d", &b);
printf("aANDb = %d\n\n", a&b);
printf("OR\n");
printf("Enter a and b\n");
scanf("%d", &a);
scanf("%d", &b);
printf("aORb = %d\n\n", a|b);
printf("XOR\n");
printf("Enter a and b\n");
scanf("%d", &a);
scanf("%d", &b);
printf("aXORb = %d\n\n", a^b);
return 0;

}
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: