Ask Question
29 January, 21:12

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.

+3
Answers (1)
  1. 29 January, 21:23
    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 & 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