+ 1
Using a while Loop
int num = 1; int number; int total ; while (num <= 2) { cin >> number; total += number; num++; } cout << total << endl; If the int total is not declare as 0, what will happen?
1 Answer
int num = 1; int number; int total ; while (num <= 2) { cin >> number; total += number; num++; } cout << total << endl; If the int total is not declare as 0, what will happen?