0

what does this code do pls explain

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

12th Jun 2019, 7:37 AM
SATYAM KUMAR
SATYAM KUMAR - avatar
3 Answers
0
It asks you for integer numbers - 5 times, sums every number you put.. and outputs the sum(total variable)
12th Jun 2019, 8:06 AM
ztonaz
ztonaz - avatar
0
So do I need to input 5 diffrent values or single value is used 5 times
12th Jun 2019, 6:26 PM
SATYAM KUMAR
SATYAM KUMAR - avatar
0
It will ask you for a number 5 times, but you could potentially put the same one each time.
12th Jun 2019, 6:39 PM
Jackson O’Donnell