Void main()
{
char ch = 37;
printf ("\n%d",ch);
ch = ~ch;
printf ("\n%d",ch);
char ch = 127;
printf ("\n%d",ch);
ch = ch << 1;
printf ("\n%d",ch);
ch = ch << 3;
printf ("\n%d",ch);
char ch = 127;
printf ("\n%d",ch);
ch = ch >> 1;
printf ("\n%d",ch);
ch = ch >> 3;
printf ("\n%d",ch);
/* OR OPERATOR */
char ch = 82;
printf ("%d\n",ch);
/* SET BIT 4th */
ch = ch | 8;
printf ("%d\n",ch);
/* AND OPERATOR */
char ch = 82;
printf ("\n%d",ch);
/* TEST 5th BIT */
if ((ch & 16) == 16)
printf ("\n5th BIT ON");
else
printf ("\n5th BIT OFF");
if ((ch & 4) == 4)
printf ("\n3rd BIT ON");
else
printf ("\n3rd BIT OFF");
/* TURNING OF 7th BIT */
ch = ch & 191;
printf ("\n%d",ch);
getch();
}
{
char ch = 37;
printf ("\n%d",ch);
ch = ~ch;
printf ("\n%d",ch);
char ch = 127;
printf ("\n%d",ch);
ch = ch << 1;
printf ("\n%d",ch);
ch = ch << 3;
printf ("\n%d",ch);
char ch = 127;
printf ("\n%d",ch);
ch = ch >> 1;
printf ("\n%d",ch);
ch = ch >> 3;
printf ("\n%d",ch);
/* OR OPERATOR */
char ch = 82;
printf ("%d\n",ch);
/* SET BIT 4th */
ch = ch | 8;
printf ("%d\n",ch);
/* AND OPERATOR */
char ch = 82;
printf ("\n%d",ch);
/* TEST 5th BIT */
if ((ch & 16) == 16)
printf ("\n5th BIT ON");
else
printf ("\n5th BIT OFF");
if ((ch & 4) == 4)
printf ("\n3rd BIT ON");
else
printf ("\n3rd BIT OFF");
/* TURNING OF 7th BIT */
ch = ch & 191;
printf ("\n%d",ch);
getch();
}
0 comments :
Post a Comment