0
:) pennies.c exists
:) pennies.c compiles
:( 28 days, 1 penny on first day
\ expected output, but not "The total number of pennies is: $ 26843..."
:( 31 days, 1 penny on first day
\ expected output, but not "The total number of pennies is: $ 21474..."
:( 29 days, 2 pennies on first day
\ expected output, but not "The total number of pennies is: $ 10737..."
:( 30 days, 30 pennies on first day
\ expected output, but not "The total number of pennies is: $ 32212..."
:) rejects days not 28, 29, 30, or 31
:) rejects non-positive pennies
:) rejects a non-numeric days input of "foo"
:) rejects a non-numeric penny input of "foo"
:) rejects a non-numeric days input of ""
:) rejects a non-numeric penny input of ""

That's what I'm getting even though when I run my program, my output is:

Enter the number of days in the month: 31
Enter the number of pennies received on the first day: 1
The total number of pennies is: $ 21474836.47 

Does anyone know why? It would be extremely helpful.

1

The problem is not the calculation. The output it does not expect is The total number of pennies is:.

From the spec:

So that we can automate some tests of your code, we ask that your program’s last line of output be the amount owed to a user, followed by \n. The rest of your program’s personality we leave entirely to you!

1
  • I was still getting it wrong but apparently that was because of a space.. But it works now. Thank you so much. Apr 17 '17 at 14:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .