407946.1518280.qx3zqy7 Jump to level 1 Write a while loop that sums all integers read from input until a negative intege
-
answerhappygod
- Site Admin
- Posts: 899604
- 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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!