The sum of all even numbers is supposed to be stored in `sum_even`

. This variable has been initialized as `0`

(the additive identity).

The product of all odd numbers is supposed to be stored in `product_odd`

. However, we shouldn’t initialize it as `0`

, because any number multiplied by `0`

will result in `0`

. Instead, we initialize it as `1`

(the multiplicative identity).

You have stored the numbers `2, 4, 3, 6, 1, 9`

in a vector of integers. Notice, how we didn’t have to separate the numbers manually into two separate vectors. We will let our code figure out whether a number is odd or even, and handle it accordingly (saving us the boring and tedious work of separating the numbers ourselves).

Then you have a `for`

loop which is meant to allow us to process all the numbers in the vector one-by-one. The loop variable `i`

is being used to iterate over the index of the vector elements. In each iteration of the loop, we are going to use an if-else statement to check whether the number is odd or even.

If the number is even, we add it to the `sum_even`

variable.

```
// You wrote:
sum_even += vector[i];
// which is the same as:
sum_even = sum_even + vector[i];
//(new sum) = (old sum) + (current number)
```

If the number is not even, then it must be odd. In that case, we use the `else`

block to multiply the number with the value stored in `product_odd`

,

```
// You wrote:
product_odd *= vector[i];
// which is the same as:
product_odd = product_odd * vector[i];
//(new product) = (old product) * (current number)
```

To determine whether a number is even/odd, we can use the modulo/modulus operator. The `%`

operator gives the remainder after we have done integer division. For Example,

```
std::cout << 30 % 4;
// 2
std::cout << 13 % 5;
// 3
std::cout << 1 % 9;
// 1
std::cout << 24 % 6;
// 0
```

If a number is even then it must be perfectly divisible by 2 and will therefore have no remainder or `0`

remainder. We can write this as the condition,

```
// if number is even
if (vector[i] % 2 == 0) {
```

If a number is odd then it is not divisible by 2 and will therefore have a remainder of `1`

. If we wanted, we could explicitly write this as the condition,

```
// if number is odd
if (vector[i] % 2 == 1) {
```

However, an `if-else`

structure means that once we have determined that a number is not even, then it must be odd and therefore a `else`

block will suffice and we don’t have to explicitly write the condition for odd numbers.

After the loop has iterated over the whole vector, then `sum_even`

and `product_odd`

will have the final totals which we can then print.