+ 1
What is the output of this code?
for(int i=0; i<10; i++){ if(i&1){ cout<<i; }}
2 Answers
+ 2
It will print all odd numbers in the range 0-10 in a row => 13579.
i & 1 is a bitwise operation. It will check if i's last bit is 1, which is only true for odd numbers.
+ 1
Just put it in the code playground and run to get the output, unless you want an explanation of how the code works



