daniel_lawson9999

Daniel Lawson Water Program

Sep 21st, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 KB | None | 0 0
  1. #include <cs50.h>
  2. #include <stdio.h>
  3.  
  4.  
  5.  
  6. int main(void){
  7.     int minutes;
  8.     do{
  9.         printf("minutes: ");  //prompt for minutes until you get a valid number
  10.         minutes = get_int();
  11.     }while(minutes<=0);
  12.  
  13.     int bottles = minutes*12; //multiply minutes*12
  14.     printf("bottles: %d\n",bottles);// print the bottles
  15.  
  16.  
  17. }
  18. /*
  19. -ask for minutes (prompt and store)
  20. -repeat previous line until mintues >0
  21. -convert to bottle (*12)
  22. -print
  23.  
  24. desired output:
  25. ~/workspace/pset1 $ ./water
  26. minutes: 10
  27. bottles: 120
  28. */
Advertisement
Add Comment
Please, Sign In to add comment