Created
June 2, 2016 17:38
-
-
Save CraigRodrigues/aeff70c00abf8fd4628f19e57c837a55 to your computer and use it in GitHub Desktop.
My solution to CS50 pset1 - "Smart Water" (modified)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <cs50.h> | |
// function that returns the number of 16oz bottles used | |
int getBottles(int time, int showerflow) | |
{ | |
return (time * showerflow)/16; | |
} | |
int main(void) | |
{ | |
printf("How long did you shower today? (minutes)\n"); | |
int time = GetInt(); | |
printf("What is your showerhead flow? (oz/minute)\n"); | |
int showerflow = GetInt(); | |
int bottles = getBottles(time, showerflow); | |
printf("Minutes Showered: %i\n16oz Bottles Used: %i\n", time, bottles); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment