0

while loop

int num = 1; int number; int total = 0; while (num <= 5) { cin >> number; total += number; num++; } cout << total << endl; can't understand this code do ?!

10th Nov 2016, 1:58 PM
kareem osama
kareem osama - avatar
1 Odpowiedź
0
This code asks five times for a input and than prints result of that sum.
10th Nov 2016, 2:03 PM
Ondřej Doněk
Ondřej Doněk - avatar