Question
Abundant numbers are positive integers (greater than 0), that are less than the sum of their proper divisors. A proper divisor is a positive integer
Abundant numbers are positive integers (greater than 0), that are less than the sum of their proper divisors. A proper divisor is a positive integer into which that number can be divided with no remainder. A proper divisor must also be less than the number itself. For example, 6 is a proper divisor of 12, but 12 is not a proper divisor of 12. The proper divisors of 12 are 1,2, 3, 4 and 6. Their sum is 16 - (1+2+3+4+6), which is greater than 12. Therefore, 12 is an example of an abundant number. As this example shows, one way to find out all the proper divisors of a number is to try out each integer (starting at 1) until you reach the number divided by 2. Write a program that reads in a list of numbers from an input text file called input.txt. For each number read, your program should determine and print out whether or not that number is abundant. The format for the input file is specified in the section: “Input Specification.”
Input Specification:
1.The first line of the file contains a single integer n that is less than 100. This number (n) indicates the number of test cases in the file.
2. The next n lines will each contain a single positive integer (less than 100). Your program must test each of these numbers to determine whether it is abundant or not.
Output Specification:
Output a line with one of the two the following formats for each test case:
Test case #t: X is abundant.
Test case #t: X is NOT abundant.
Where t represents the number of the test case (starting with 1), and X represents the number for that case.
"Using Dev-C coding" not C++
Step by Step Solution
3.38 Rating (176 Votes )
There are 3 Steps involved in it
Step: 1
include include include int ma...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started