Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cs50.h>
- #include <stdio.h>
- int main(void){
- int minutes;
- do{
- printf("minutes: "); //prompt for minutes until you get a valid number
- minutes = get_int();
- }while(minutes<=0);
- int bottles = minutes*12; //multiply minutes*12
- printf("bottles: %d\n",bottles);// print the bottles
- }
- /*
- -ask for minutes (prompt and store)
- -repeat previous line until mintues >0
- -convert to bottle (*12)
- -print
- desired output:
- ~/workspace/pset1 $ ./water
- minutes: 10
- bottles: 120
- */
Advertisement
Add Comment
Please, Sign In to add comment