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;
3 Answers
0
It asks you for integer numbers - 5 times, sums every number you put.. and outputs the sum(total variable)
0
So do I need to input 5 diffrent values or single value is used 5 times
0
It will ask you for a number 5 times, but you could potentially put the same one each time.