Explanation

Can someone please explain to me what is sum=0 and product=1 in an exercise of c++

sum is a "variable".

It stores a value.

You create a variable (in this case giving that variable a name, "sum") and use it to hold a value; for example a number.

sum=0
In this case, the variable "sum" is for holding numbers, and it is being used to store the number zero.

Later, the variable can be examined and the value stored in it can be got back.

You could think of it like having a piece of paper labelled "sum", and on that piece of paper you write the number zero. Later, when you look at that piece of paper again, you can read that it holds the value zero.

product=1
This is a different variable, being used to hold a different number.
Topic archived. No new replies allowed.