Ask Question
30 January, 20:24

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.

Answers (1)
  1. A
    31 January, 00:11
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers
Sign In
Ask Question