24. WAP to understand shift operator.
#include<stdio.h>
void
main()
{
// Part 1
//int i=10,j=2,k;
//k=i<<j;
//printf("i=%d j=%d
k=%d\n",i,j,k);
// Part 2
//int i=0,j=1,k;
//i=i-1;
//k=i>>j;
//printf("k=%d\n",k);
// Part 3
unsigned int i=0,j=1,k;
i=i-1;
printf("i=%d\n",i);
k=i>>j;
printf("k=%d\n",k);
}
Comments
Post a Comment