Question:
Assuming there are 7.481 gallons in a cubic foot, write a program that asks the user to enter a number of gallons, and then displays the equivalent in cubic feet.
Code:
Output:
Assuming there are 7.481 gallons in a cubic foot, write a program that asks the user to enter a number of gallons, and then displays the equivalent in cubic feet.
Code:
// converts gallons to cubic feet
#include <iostream>
using namespace std;
int main()
{
float gallons, cufeet;
cout
<< "\nEnter quantity in gallons: ";
cin
>> gallons;
cufeet
= gallons / 7.481;
cout
<< "Equivalent in cublic feet is "
<< cufeet << endl;
return 0;
}
Output:
0 Questions:
Post a Comment