Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
My solution to CS50 pset1 - "Smart Water" (modified)
#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
You can’t perform that action at this time.