Ask Question

Write a program with a loop that asks the user to enter a series of positive numbers. the user should enter a negative number to signal the end of the series. after all the positive numbers have been entered, the program should display their sum.

+1
Answers (1)
  1. 4 November, 16:50
    0
    Int main (void) {

    int n, s=0;

    while (1) {

    scanf (" %d",&n);

    if (n<0) break;

    s+=n;

    }

    printf ("sum=%d/n", s);

    return 0;

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a program with a loop that asks the user to enter a series of positive numbers. the user should enter a negative number to signal the ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers