how 20 appears in o/p?

#include<stdio.h>
int main(){
int c=5;
printf("%d %d %d ",c,c<<2,c>>2);
}

its output :
5 20 1

<< is bit shift operation, if you do not know binary numbers, you can assume, that <<1 multiplies number by 2, <<2 multiplies value by 4, << 3 by 8 (2^3) and so on…

5 << 2 = 5 * 4 = 20
1 Like

n << b means n*(2^b)

n >> b means n/(2^b)

only valid for integer type only.

//