Ask Question
9 November, 08:22

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.

+1
Answers (1)
  1. 9 November, 10:29
    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?
Get 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 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