+ 2
Explain in Detail!
Code: #include <iostream> using namespace std; int main() { int num = 1; int number; int total = 0; while (num <= 5) { cin >> number; total += number; num++; } cout << total << endl; return 0; } what does total += number mean? what is its alternative(total += number)
5 Answers
+ 14
while loops 5 time and every time it loop , it recieve one number from user , every time it recieve new number it sum "total" variable with new number and save it in total
when loop ends it print total value
+ 14
is this enough or need more explanation ?
+ 14
it means
total = total + number
+ 13
it recieve 5 number & calculate them summation
0
total +=number means what?