your program will print 16 bit binary equivalent.
let,instead of "0 to 15" , for loop iterates from "0 to 3" to print 4 bit binary equivalent.
then working is as given below:
num=2 . binary equivalent =0010
iteration 1: i=0
2<<0 & 1<<3 means left shift 2 by 0 and 1 by 3 and then perform bitwise and(&) of both
as 2<<0=0010 and 1<<3= 1000 therefore ending both will give us 0000 therefore 0 will be printed according to condition,
iteration 2: i=1
2<<1&1<<3=0100&1000=0000, 0 will be printed
iteration 3: i=2
2<<2&1<<3= 1000&1000=1000 (non zero), 1 will be printed
iteration 4:i=3
2<<3&1<<3=0000& 1000 =0000 , zero fill be printed
therefore final result on screen will be 0010
similarly u can analyze for 16 bit output.
LOGIC OF PROGRAM:
extract one bit from left side of binary representation of given number by left shifting and then check whether it is 1 or 0 by ending it with 1 and print the result of ending.