/* To show the
implementation of Bitwise Operators */
#include<stdio.h>
#include<conio.h>
void
main()
{
unsigned int a=60;
unsigned int b=13;
unsigned int c=0;
clrscr();
printf("\nA=60");
printf("\nB=13");
/* To implement Logical AND */
c=a&b;
printf("\n\nOn implementing Logical
AND:\t");
printf("%u",c);
/* To
implement Logical OR */
c=a|b;
printf("\nOn implementing Logical
OR:\t");
printf("%u",c);
/* To
implement Logical XOR */
c=a^b;
printf("\nOn implementing Logical XOR:\t");
printf("%u",c);
/* To
implement Left Shift */
c=a<<2;
printf("\nOn implementing Left
Shift:\t");
printf("%u",c);
/* To implement Right Shift */
c=a>>2;
printf("\nOn implementing Right
Shift:\t");
printf("%u",c);
getch();
}
OUTPUT
A=60
B=13
On
implementing Logical AND: 12
On
implementing Logical OR: 61
On
implementing Logical XOR: 49
On
implementing Left Shift: 240
On
implementing Right Shift: 15
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.