+ 1

How does the output is 13579??? (Can't understand (i&1) place)

int main() { for (int i=0;i<10;i++) { if(i&1){ cout<<i;} }

13th Apr 2018, 5:57 PM
Shaitzu15
Shaitzu15 - avatar
4 Answers
0
Got it! Ariela thanks
13th Apr 2018, 6:10 PM
Shaitzu15
Shaitzu15 - avatar
0
#include <iostream> using namespace std; int main() { for (int i=0;i<10;i++) { cout<<i*2+1; } return 0; }
13th Apr 2018, 9:15 PM
ПафусоĐș
ПафусоĐș - avatar
0
Fistefalo then what about 5*2+1? Doesn't make sense to answer. Cause for loop goes 10 times
14th Apr 2018, 4:42 AM
Shaitzu15
Shaitzu15 - avatar