Code:
#include <stdio.h>
void liquid(float, float, float, float);
int main(void)
{
int remainder, input;
float input, gallons, quarts, pints, cups;
printf("How many cups do you have?: \n");
scanf("%d",&input);
gallons = (float)input/16.0f;
remainder = input % 16;
quarts = (float)remainder/4.0f;
remainder = remainder % 4;
pints = (float)remainder/2.0f;
remainder = remainder % 2;
cups = remainder;
liquid(&gallons, &quarts, &pints, &cups);
return 0;
}
void liquid(float gallons, float quarts, float pints, float cups)
{
printf("You have %.0f gallon(s).\n",gallons);
printf("You have %.0f quart(s).\n",quarts);
printf("You have %.0f pint(s).\n",pints);
printf("You have %.0f cup(s).\n",cups);
return;
}
Wurks 2.