Well, I'm tryin to make a for loop that computes the sum of the odd numbers in the range from 0 to 100.

So far i have

#include <iostream>

#include <iomanip>

using namespace std;

int main()

{

int odd = 1;

}

i need a FOR (something,something,something)

and an IF statement.

and then i dont know what to do for the rest of the part... =(

i know if you add like all the odd numbers from 1 to 100 it would equal 3000.

how would i just take the odd numbers and add them all together using a for loop?

Please Reply If you know the answer to my question

The algorithm is simple:

First of all, you need to know what is the difference between

- even number ( 2, 4, 6, 8...etc )

- odd number ( 1, 3, 5, 7....etc )

{2, 4, 6, 8...etc} divided by 2. The rest number will be Zero

{1, 3, 5, 7....etc} divided by 2. The rest number will be One

The operator you can use to calculate the the rest number from division is modulo ( % ).

Example:

4 % 2 = 0 : because the rest number is Zero ( even number )

2 % 3 = 2 : because 2 is the rest number after we 2/3

3 % 2 = 1 : odd number

- Go looping through 0 to 100 ( as what is instructed in your requirement )

- In each instance of your loop, test if it is odd/ even ( use modulo above )

Hope this will help!!

/looker