1

![ My code works but it is not compiling. I ran check50 and it says that water.c exists :) but does not compile. I'm struggling to understand why.]1

2
  • try doing the n * b in a variable outside printf then print this variable. %u is telling printf to print a variable which you have told printf is called n * b but no variable called this exits. Commented Mar 17, 2017 at 3:33
  • The compiler error you show (link to the report, showing more than the terminal) does not match the code above. The code you presented should compile (maybe missing return), just print a number of bottles even if you entered an invalid number of minutes. For fixing that, follow masterseeker's advice to print the product after the loop (either with b also declared outside, or using 12 instead of b). I'd not use a \n after "Minutes:" for layout reasons, you create a line break when entering/submitting a number..
    – Blauelf
    Commented Mar 17, 2017 at 11:12

2 Answers 2

0

The code shown in the image and the compiler complaint in the sandbox result do not match. Could indicate that you made changes to the source code, but did not save before trying check50. Actually, one should compile (make) and test (./water) the program before ever submitting to check50.

0

The main problem is because you didn't save your work. I had the same problem because I was testing and didn't save last changes. Also, consider to change your b for 12. It's redundancy to use in your case.

You must log in to answer this question.

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