0
#include <stdio.h>
 #include <cs50.h>

int main(void)
{
int n;
do 
{
    n = GetInt();
}
while (n <= 0);
printf("Minutes: %i\n",n);
printf("Bottles: %i\n",n*12);
}

When I do check50, error occur:

~/workspace/pset1/ $ check50 2016.water water.c

:) water.c exists
:) water.c compiles
:( 1 minute equals 12 bottles
\ expected output, not a prompt for input
:( 2 minutes equals 24 bottles
\ expected output, not a prompt for input
:( 5 minutes equals 60 bottles
 \ expected output, not a prompt for input
:( 10 minutes equals 120 bottles
\ expected output, not a prompt for input
:( rejects "foo" minutes
 \ expected output, not a prompt for input

...

Can anyone help me with this issue?

1

Prompt the user first, then get n. Not vice versa.

1
  • I have already got the same answer on facebook CS50 group. Still thanks.
    – juanli
    Jul 3 '17 at 13:24

You must log in to answer this question.

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