Ask Question
25 March, 15:32

Write a program that reads in a list of numbers, and for each number, determines and prints out whether or not that number is abundant.

+2
Answers (1)
  1. 25 March, 16:19
    0
    int IsAbundant (int n)

    {

    int divisorSum = 0;

    for (int i = 1; i < n; i++) {

    if ((n % i) = = 0) {

    divisorSum + = i;

    }

    }

    return divisorSum > n;

    }

    int main ()

    {

    int number = 0;

    do {

    printf ("Enter a number (0 to quit) : ");

    scanf_s ("%d", &number);

    if (IsAbundant (number)) {

    printf ("%d is abundant!/n", number);

    } else

    {

    printf ("%d is not abundant./n", number); }

    } while (number > 0);

    return 0;

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a program that reads in a list of numbers, and for each number, determines and prints out whether or not that number is abundant. ...” 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