407946.1518280.qx3zqy7 Jump to level 1 Write a while loop that sums all integers read from input until a negative intege

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
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

Post by answerhappygod »

407946 1518280 Qx3zqy7 Jump To Level 1 Write A While Loop That Sums All Integers Read From Input Until A Negative Intege 1
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 27 times
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!
Post Reply