+ 1

Meaning of "int total"

Why in this example "int total" is equals 0??? Using a while Loop Now let's modify our code to calculate the sum of the numbers the user has entered. int num = 1; int number; int total = 0; while (num <= 5) { cin >> number; total += number; num++; } cout << total << endl;

4th Nov 2019, 7:58 PM
Eduardo Urbiola
Eduardo Urbiola - avatar
2 ответов
+ 1
Hello Eduardo Urbiola , For future reference, please avoid writing code into Relevant Tags section of the question. It's good enough to specify the language there instead, e.g. C++ 👍
4th Nov 2019, 9:12 PM
Ipang