Having trouble getting the right output out of this assignment.

The assignment is:

Write a C function named licquid() that is to accept an integer number and the addresses of the variables gallons, quarts, pints, and cups. The passed integer represents the total number of cups, and function is to determine the number of gallons, quarts, pints, and cups in the passed value. Using the passed addresses, the function should directly alter the respective variables in the calling funcion. Use the relationships of 2 cups to a pint, 4 cups to a quart, and 16 cups to a gallon.

Include the function in a program, printing the results after the function has run.

If the user enters 27 cups, the output should be:

1 gallon

2 quarts

1 pint

1 cup

This is what I have so far:

Code:

#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)
{
if (x >= 16)
*gallons = (x / 16;
printf("The number of gallons is %d\n", *gallons);
if (x >= 8)
*quarts = x / 8;
printf("The number of quarts is %d\n", *quarts);
if (x >= 4)
*pints = x / 4;
printf("The number of pints is %d\n", *pints);
if (x < 4)
*cups = x;
printf("The number of cups is %d\n", *cups);
return;
}

My output after entering 27 cups is:

The number of gallons is 1

The number of quarts is 3

The number of pints is 6

The number of cups is 1345

I don't quite understand what i'm doing wrong could somebody please point me in the right direction.