# Need help on the homework (if statements)

This is a discussion on Need help on the homework (if statements) within the C++ Programming forums, part of the General Programming Boards category; I'm having a trouble to make a program that can distinguish an "abundant" number. Here's the question: Arup really cares ...

1. ## Need help on the homework (if statements)

I'm having a trouble to make a program that can distinguish an "abundant" number. Here's the question:

Arup really cares about divisibility. He especially likes numbers that have lots of divisors. In particular, he likes numbers with proper divisors that sum to greater than the number itself. These numbers are called, “abundant numbers.” A proper divisor of a number is any number strictly less than it that divides evenly into it. For example, 6 is a proper divisor of 12, but 12 is not. 12 is an example of an abundant number because 1+2+3+4+6 = 16 and 16 is greater than 12. As this example shows, one way to find out all the proper divisors of a number is to try each integer (starting at 1) out until you reach the number divided by 2. (It’s impossible for any number in between 7 and 11 to divide evenly into 12 because it is guaranteed that the result of the division is less than 2 since we are dividing by a greater number, and greater than 1, since we are not dividing by the number itself.)

Input Specification
1. The first integer line of the file will be a positive integer, n (less than 1000), indicating the number of test cases in the file.
2. The next n lines will contain a single positive integer each (less than 10000), with the number you are to determine is abundant or not for that test case.

This is what I have so far:

Code:
```#include <stdio.h>
int main () {
FILE *kam;
int numb, numcases;

kam = fopen("numbers.text", "r");

fscanf(ifp, "%d", &numcases);

for (numb=1; numcases >= numb; numb++)
{
if ...```

I know it involves with the if statements, but I'm having trouble to make the conditions to print out whether a number is an abundant or not.

2. *fscanf(kam, "%d", &numcases)

3. You need to 1) read a number 2) find the divisors 3) add up the divisors (you do this at the same time as 2) 4) compare the sum with the number 5) print out appropriately.

4. Hy! I'm having a trouble to run a program. I have error: Unable to open include file 'graphics.h'
Thank you