44. The for loop

for( i=0; i<10; ++i)

printf("%d", i & 1);

prints

- Option : A
- Explanation :

The binary representation of odd numbers will have a 1 as the least significant digit. So, an odd number ANDed with 1, produces a 1.

Even number end with 0. So. an even number ANDed with 1, produces a 0.

This for loop generates even and odd numbers alternatively.

So, it prints alternate 0's and 1's

*/?>

*/?>

*/?>

*/?>