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
Which of the following would most likely be the target audience for a product
inna [77]

Answer:

B

Explanation:

They are saturday morning cartoons. Saturday morning cartoons are meant towards an audience of young children.

3 0
3 years ago
Read 2 more answers
Using a pin or password in addition to tpm is an example of what type of authentication?
anzhelika [568]
Considering it is private i would say security?
3 0
3 years ago
The changing of values for an object through a system is represented by the _____. (Points : 6) communication diagram
Fed [463]

Answer:

The correct option is communication diagram

Explanation:

The communication diagram represents the change of values for an item by a system.

A communication diagram is an expansion of the diagram of objects showing the objects together with the texts traveling from one to another. Besides the connections between objects, the communication diagram demonstrates the messages that the objects send to one another.

The correct option is a) communication diagram

8 0
3 years ago
What is the other name of iterative staatement ​
Mademuasel [1]

Answer:

An loop statement

Explanation:

An iteration statement, loop, repeatedly executes a statement, know as a loop body,until the controlling expression is false

8 0
3 years ago
You are attempting to print a document from your workstation to the network printer in your office. The print job failed when yo
Helen [10]

Answer:

An Incident

Explanation:

an incident is an unplanned interruption to a service

6 0
2 years ago
Other questions:
  • Suppose your SOHO network connects to the Internet using cable modem. When you open your browser and try to access a web site, y
    8·1 answer
  • In order for Dr. Reynolds to send a CPOE from her office computer system to the computer system at the local hospital, a/an ____
    5·1 answer
  • What is the purpose of exporting your public key to the directory services server?
    11·1 answer
  • IN THE MOVIE BACK TO THE FUTURE 1985 IS 1985 THE PUBLICATION DATE?WHERE CAN I FIND THE MOVIE?
    6·1 answer
  • What is the difference, if any, between an alpha test group and a beta test group? An alpha test group is made up of people asso
    9·1 answer
  • In one to two sentences, explain why citizens pay taxes
    8·1 answer
  • 2. What is a cap? (0.5 points)
    9·1 answer
  • In chapter 3, we discussed syntax and semantics, in general there are two types of grammars for programming languages, regular a
    14·1 answer
  • To access documents stored on a "cloud", you'll
    12·1 answer
  • Write a class called TextProcessor that implements the methods listed below. Your implementation may use the charAt() and length
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!