0

so I am very new to this but I have written some code to complete the pset1 water task and it just won't pass through check50 2016.water water.c. I have put it below, I understand that it maybe all over the place, but it does exactly what I am asked for. I have tried everything that I can think of, which granted isnt much at this stage and I've looked through off the relevant questions on here. So if anyone could help me to see where Ive gone wrong, either in the code or else where that would be amazing!

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

int main(void)
{
int i;
do
{
  i = get_int();
}
while (i < 0);

{
   printf("Minutes: %d\n", i);
   printf("Bottles: %d\n", i*12);
}
}

int product(int i)
{
return i * 12;
}

enter image description here

0

Here's how the program should behave, from the Usage section of the spec (using italics to represent what the user types, instead of underline):

$ ./water
Minutes: 1
Bottles: 12

"Minutes" should be prompted (displayed) before user enters a value. The entered valued should not be output.

| improve this answer | |
0

Try to start from this!

Water

1.5 gallons/min

1.5 (gallons) * 128 (ounces) = 192 ounces/m

1 gallon = 128 ounces

192 (ounces/m) / 16 (ounces/bottle) = 12 boottles/m => 10 mins .... 120 (bottles)

1 bottle of water = 16 ounces

do

    {
        // minutes
    }

    while ();

    int ;

    {
        // bottles
    }
| improve this answer | |

You must log in to answer this question.

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