1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Helen [10]
3 years ago
8

Write a C function namedliquid()that is to accept an integer number and theaddresses of the variablesgallons,quarts,pints, andcu

ps. The passed integer rep-resents thetotalnumber of cups, and the function is to determine the number of gal-lons, quarts, pints, and cups in the passed value. Using the passed addresses, the functionshould directly alter the respective variables in the calling function. Use the relationshipsof 2 cups to a pint, 4 cups to a quart, and 16 cups to a gallon.
Computers and Technology
1 answer:
salantis [7]3 years ago
5 0

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;

}

You might be interested in
Can u tell me the answers to this table ​
Sholpan [36]

: im sorry what dose it say it is too blurry

6 0
3 years ago
Mrs. Schlair has an annual salary of $96,402.<br> a. What would her semimonthly salary be?
amid [387]

Answer:$4016.75

Explanation:64333/24

3 0
3 years ago
________ is a wireless protocol designed for transmitting data over short distances, replacing cables. ipv6 ipv4 paas bluetooth
KIM [24]
Wifi is a wireless protocol designed
3 0
3 years ago
What are 2 ways to send a message to your client when signed in as an accountant user?.
7nadin3 [17]

Answer:

The use of Ask client and request are 2 ways to send a message to your client when signed in as an accountant user.

4 0
2 years ago
Why is the keyboard arranged in the QWERTY style?
ArbitrLikvidat [17]
Most of us were taught that the man who invented the keyboard created the QWERTY design to slow typists down. The faster someone typed, the more often the typewriter jammed
6 0
3 years ago
Read 2 more answers
Other questions:
  • Which strategies should you follow if you begin to feel fatigued while driving
    12·2 answers
  • Divide (10x^3 + 19x^2 + x - 7) by (5x + 2)​
    11·1 answer
  • Sql provides the ________ technique, which involves placing an inner query within the where or having clause of an outer query.
    8·1 answer
  • The while loop is a pre-test loop? TRUE OR FALSE
    9·2 answers
  • Write a program that uses an "if" statement to determine if the number is greater than one. If the number is greater than 1, the
    9·1 answer
  • Which type of unshielded twisted pair (UTP) is commonly used in Ethernet 10BASE-T networks, which carry data at a rate of 10 Mbp
    14·1 answer
  • List three examples of telescopes that detect different types of electromagnetic radiation?
    11·1 answer
  • The process of recording and reporting the financial data for a business is known as:
    6·2 answers
  • I need help with this question!
    11·1 answer
  • Define computer architecture?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!