My output was okay but it showed this error.

:( rejects "foo" minutes
   \ expected prompt for input, not exit code of 0
:( rejects "" minutes
   \ expected output, not a prompt for input
:( rejects "123abc" minutes

2 Answers 2


in 2017 the GetInt() function is depreciated

water.c:8:9: warning: 'GetInt' is deprecated [-Wdeprecated-declarations]

now use


It works for:-

  • Positive Integer
  • Negative Integer
  • Zero
  • otherwise user is prompted to "retry".

note: view the Walkthrough video.


You would need to use cs50's GetInt() function to get the user input. Using scanf - which is what I did wrong to get user input produces the error above.

To solve this, do the following. If you are using the cs50 appliance or IDE go to step 2. If you are using your system or anything else start with step 1.

  1. You have install the cs50 library on your system here.

  2. Add #include <cs50.h> at the top of the file.

  3. Compile using clang -o -g -Wall water.c -o water -lcs50 or gcc -g -Wall water.c -o water -lcs50 (if you want to use gdb)

I hope it works for you!

You must log in to answer this question.

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