Question: 3 Write a program that calculates the number of gallons, quarts, pints and cups in a 42 liter gas tank. Use modulus, integer divide operations
3 Write a program that calculates the number of gallons, quarts, pints and cups in a 42 liter gas tank. Use modulus, integer divide operations and type coercion. 1 gallon = 4 quarts = 8 pints = 16 cups = 3.78541 liters. Only the smallest value should have decimal places, all the other values should be integers. Find out the total amount of cups, then from that go up to gallons. Use type coercion, save the decimal part, and work with the integer part. At the end, recover the decimal part into the smallest unit. In C++ please
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
