- 1

[ASSIGNMENT] find odd numbers 1 to 30 using for loop

what is code of that in c program

28th Mar 2018, 6:36 PM
Jordan
Jordan  - avatar
5 Answers
+ 3
for (int i = 1; i <= 30; i++) { if (i % 2 != 0) { printf("%d", i); } } Put your own code inside the if statement if you want to do something different with the odd number
28th Mar 2018, 6:39 PM
TurtleShell
TurtleShell - avatar
+ 3
Jordan you literally just posted this same question except that you asked 1 to 20....... https://www.sololearn.com/Discuss/1175754/how-to-print-1-to-20
28th Mar 2018, 6:47 PM
Ole113
Ole113 - avatar
+ 1
@Ole113 Yeah I realised that too but it doesn’t really matter
28th Mar 2018, 6:49 PM
TurtleShell
TurtleShell - avatar
0
@Ole113 I realised it was the same guy before I wrote my post
28th Mar 2018, 6:55 PM
TurtleShell
TurtleShell - avatar
- 1
@TurtleShell how did you just realize that....
28th Mar 2018, 6:54 PM
Ole113
Ole113 - avatar