+ 3

The code provided by the app itself is NOT WORKING

#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; } it's supposed to ask the user to enter a number 5 times and then shows their sum. But what happens when I run the code that it asks to enter the input only once then multiply it with the "while" condition so what's wrong

16th Jul 2017, 10:27 PM
Salma Mohsen
Salma Mohsen - avatar
2 Réponses
0
you have to run it out of SoloLearn app .. maybe C++Dev or Code:Blocks on Computer.
20th Aug 2017, 8:50 AM
MUHAMMED GENCO
MUHAMMED GENCO - avatar