Answer:
#include <stdio.h>
#include <math.h>
void liquid(int ,int*,int*,int*,int*);
int main()
{
int num1, gallons, quarts, pints, cups;
printf("Enter the number of cups:");
scanf("%2d",&num1);
liquid(num1, &gallons, &quarts, &pints, &cups);
return 0;
}
void liquid(int x, int *gallons, int *quarts, int *pints, int *cups)
{
static int y;
y = x;
if (y >= 16)
{
*gallons = (y / 16);
printf("The number of gallons is %3d\n", *gallons);
}
if (y - (*gallons * 16) >= 4)
{
*quarts = ((y - (*gallons * 16)) / 4);
printf("The number of quarts is %3d\n", *quarts);
}
if ((y - (*gallons * 16) - (*quarts * 4)) >= 2)
{
*pints = ((y - (*gallons * 16) - (*quarts * 4)) / 2);
printf("The number of pints is %3d\n", *pints);
}
if ((y - (*gallons * 16) - (*quarts * 4) - (*pints *2)) < 2 || y == 0)
{
*cups = (y - (*gallons * 16) - (*quarts * 4) - (*pints *2));
printf("The number of cups is %3d\n", *cups);
}
return;
}