- 1

How to print out odd numbers from 0-50

25th Apr 2017, 7:24 AM
Evans Godsaint Junior
Evans Godsaint Junior - avatar
5 Answers
+ 11
for (int i = 1; i < 50; i += 2) { cout << i << endl; }
25th Apr 2017, 7:25 AM
Hatsy Rei
Hatsy Rei - avatar
+ 4
int x=0; while(x<=50) { cout << x << endl; x++; }
25th Apr 2017, 8:36 AM
Nithiwat
Nithiwat - avatar
+ 2
int i=0; do { if(i%2==1) cout <<i <<endl; } while (++i <50);
25th Apr 2017, 8:41 AM
CalviŐ˛
CalviŐ˛ - avatar
0
#include <iostream> using namespace std; int main() { int x = 1; while (x<=50){ cout <<"Number"<<x<<endl; x=x+2; } return 0; }
27th Apr 2017, 3:01 AM
Avi Patel
Avi Patel - avatar