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 is true about routers and switches?
Pepsi [2]

Answer:

Routers control traffic between networks while switches control traffic within a network

Explanation:

Router and switches both are used to control the traffic. In local area network, different computer are connected with each other with in the organization or network. Switch is used to connect all the computers or devices in the local area network (LAN). The switch is responsible for connecting all the computers in the LAN and controlling the traffic within the LAN network.

On the other hand, Wide Area Network (WAN) is consist of multiple number of  Local Area Networks (LANs). To connect all the LAN router is used. Router is responsible for connecting all the networks in the WAN and also responsible for controlling traffic between different networks.

5 0
3 years ago
Pleaseee helpppppppppp
zloy xaker [14]

Answer:

EXAMPLE -

Create a variable and assign your age

var myage = 32;

type your age:

console.log(my age) ;

Notice that we did not type the actual numeric age. We used the variable instead. There wouldn’t be any purpose of declaring a variable if we were going to type 32 directly.

This makes the scrip more portable which means that the result on the screen is independent of the code console.log(myAge); . If we need to change our age all we have to do is to assign another number to the variable myAge and the output will change automatically. That’s the purpose of a variable.

5 0
3 years ago
What does ALU stand for?
ValentinkaMS [17]
It stands for arithmetic logic unit 
3 0
4 years ago
Read 2 more answers
Which of the following is not one of the most common causes of electrical accidents ?
defon

Cords too long. The cords may be a tripping hazard, but no electrical accident will occur because of it.

7 0
4 years ago
Read 2 more answers
Plz help meeeeee QUICKLY!!! WORTH 15 POINTS!
Lady bird [3.3K]

Answer:

Im pretty sure Domain name system but dont trust me

Explanation:

8 0
4 years ago
Other questions:
  • Individuals with desirable traits will be __________ to have young that survive than individuals without these traits. (2 points
    5·2 answers
  • An increase in the Money Supply will increase the Aggregate Price Level and will also increase which of the following?
    14·1 answer
  • if an open cut or wound is exposed to contamination washing it in hot water and hand soap is not sufficient to keep safe
    14·2 answers
  • I need to know what is share market plssss
    8·2 answers
  • In the Microsoft Office Suite, what tells a database what to insert information in the document? 
    8·1 answer
  • For the following 4-bit operation, assuming these register are ONLY 4-bits in size, which status flags are on after performing t
    14·1 answer
  • ILL GIVE BRAINLIEST TO FIRST ANSWER David is adopting an iOS app from a non-retina screen to a retina screen. The app currently
    13·1 answer
  • Level Access Test - Please Ignore
    14·1 answer
  • Thinking about the career cluster, "Information Technology", which of these careers would typically NOT be included? (Choose thr
    10·2 answers
  • Explain two protocols to enhance cellular networks capacity?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!