- 407946 1518280 Qx3zqy7 Jump To Level 1 Write A While Loop That Sums All Integers Read From Input Until A Negative Intege 1 (51.79 KiB) Viewed 26 times
407946.1518280.qx3zqy7 Jump to level 1 Write a while loop that sums all integers read from input until a negative intege
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
407946.1518280.qx3zqy7 Jump to level 1 Write a while loop that sums all integers read from input until a negative intege
407946.1518280.qx3zqy7 Jump to level 1 Write a while loop that sums all integers read from input until a negative integer is read. The negative integer should not be included in the sum. Ex: If input is 40 47 44 22 -10, then the output is: 153 1 #include <iostream> 2 using namespace std; 3 4 int main() { 5 int userNum; 6 int count; 7 8 count = 0; 9 cin>> userNum; 10 11 12 cout << count << endl; return 0; 13 14 15