Need help with first c++ prroject

I need help with writing a program. Here is the question :

Write a program with for loop, calculating the sum of all odd numbers between 1 and 100.

How can I write a loop that increases by 2 not by 1?
1
2
for (int i = 1; i <= 100; i ++)
  Put the code you need help with here.
closed account (E0p9LyTq)
for (int i = 1; i <= 100; i += 2)
1
2
3
4
5
int sum = 0;

for (int i = 0 ; i < 100 ; ++ i)
 if (i % 2 == 0) 
   sum += i;




thank you all very much !
you're welcome .
Topic archived. No new replies allowed.