- 1

# What do this code do? Please help

int num = 1; int number; int total = 0; while (num <= 5) { cin >> number; total += number; num++; } cout << total << endl;

3 Answers

+ 3

while (num <= 5): until num is greater than 5
cin >> number;: put an integer number in "number" variable
total += number;: update "total" variable adding "number" value
num++: increase num value adding 1

+ 2

Thank you :)

0

I'm not a big pro at c++ but i believe you can find your answer at this website. w3schools.com, I learnt alot from them