Ask Question
28 April, 06:41

Given that two int variables, total and amount, have been declared, write a loop that reads integers into the amount and adds all the non-negative values into the total. The loop terminates when a value of less than 0 is read into the amount. Don't forget to initialize total to 0.

+5
Answers (1)
  1. 28 April, 10:06
    0
    total=0;

    do{

    cin >> amount;

    if (amount>0)

    total + = amount;

    }

    while (amount >=0);
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Given that two int variables, total and amount, have been declared, write a loop that reads integers into the amount and adds all the ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers