can't get this to work?!

So im brand new to c programming and im trying to get some hw done but i can't seem to quite get it.
this is my assignment

The money for these scholarships comes from interest made on previous donations and investments. You will create a program to compute the yearly interest in the Fund and determine how many $1000, $500, and $250 scholarships can be awarded.

For example, if the Fund had 500,000 dollars in it on September 30th 2012 and the yearly interest rate was 3 percent then the Fund will have 515,000 dollars in it at the end of this September. This gives them $15,000 to disburse as scholarship money.

If possible, the Fund prefers to award 5 $1000 scholarships, 10 $500 scholarships, and as many $250 as they have money left for. With $15,000 the Fund can award 5 $1000 scholarships, 10 $500 scholarships, and 20 $250 scholarships. Your program should print this information for the user.

If that is not possible, the Fund will award as many $1000 and $500 scholarships as they can. For example, if they had $4,750 they would award 4 $1000 scholarships, 1 $500 scholarship, and 1 $250 scholarship.

Sample Run #1
How much was in the fund last year?
40000
What is the yearly percentage rate?
2

0 $1000 scholarships will be awarded
1 $500 scholarships will be awarded
1 $250 scholarships will be awarded

Sample Run #2
How much was in the fund last year?
1200000
What is the yearly percentage rate?
1

5 $1000 scholarships will be awarded
10 $500 scholarships will be awarded
8 $250 scholarships will be awarded

Ive been able to get the first two scholarships to show up correctly but not the last. Essentially im having problems on how i set up the formula for the remaining money thats left each time that each award amount is divided by.


This what ive been able to come up with so far any help will be appreciated thanks!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
 #include <stdio.h>
#include <math.h>

//main function
int main() {

int funds, best, middle, bottom, remain, remain_2;
float N, P;

printf("How much was in the fund last year?\n");
scanf("%f", &N);

printf("What is the yearly percentage rate?\n");
scanf("%f", &P);

funds = (N * P/100);

if (funds >= 1000)
{
best = funds / 1000;
if(best > 5)
{
best = 5;
}

printf("%d $1000 scholarships will be awarded.\n", best);
remain = funds - (best * 1000);

}

if (funds >= 500)
{
middle = (funds - remain) / 500;

if(middle > 10)
{
middle = 10;
}

printf("%d $500 scholarships will be awarded.\n", middle);
remain_2 = funds - remain;
}

if (funds >= 250)
{
bottom = (funds - remain_2) / 250;

printf("%d $250 scholarships will be awarded.\n", bottom);

}
return 0;
}
Topic archived. No new replies allowed.