+ 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;
2 Antworten
+ 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++ 👍