Right shift in C by R4R Team

What is right shift ?
Basically,shifting are possible on binary bits.

Example-
Number is: 32
Its binary is 100000
Then one right shift is 010000(i.e, 16 in decimal)


program-

#include< stdio.h>
int main() {
int n,a;
printf("Enter number\n");
scanf("%d",&n);
a=n>>1;
printf("One Right shift is %d\n",a);
a=n>>2;
printf("Two Right shift is %d\n",a);
a=n>>3;
printf("Three Right shift is %d\n",a);
}


output-

Enter number
64
One Right shift is 32
Two Right shift is 16
Three Right shift is 8

-In this program, we take an input of the integer decimal number.
-then we find the right shift by 1 bit,2 bit and 3 bit.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!