summaryrefslogtreecommitdiff
path: root/wk1/pset1
diff options
context:
space:
mode:
Diffstat (limited to 'wk1/pset1')
-rw-r--r--wk1/pset1/cash/cash.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/wk1/pset1/cash/cash.c b/wk1/pset1/cash/cash.c
index 3f561b5..eda145e 100644
--- a/wk1/pset1/cash/cash.c
+++ b/wk1/pset1/cash/cash.c
@@ -37,9 +37,10 @@ int main(void)
int get_cents(void)
{
+ int i;
do
{
- int i = get_int("How many cents? ");
+ i = get_int("How many cents? ");
}
while(i <= 0);
return i;
@@ -53,18 +54,17 @@ int calculate_quarters(int cents)
int calculate_dimes(int cents)
{
- // TODO
- return 0;
+ cents = cents / 10;
+ return cents;
}
int calculate_nickels(int cents)
{
- // TODO
- return 0;
+ cents = cents / 5;
+ return cents;
}
int calculate_pennies(int cents)
{
- // TODO
- return 0;
+ return cents;
}