Answer to Question #6656 in C++ for Anurag Saini

Question #6656
Assuming that there are 7.481 gallons in a cubic foot, write a program thatthat asks the user to enter the number of gallons, and then display the equivalent in cubic feet. program in c
1
Expert's answer
2012-02-17T10:00:56-0500
#include <stdio.h>
#include <stdlib.h>

int main()
{
& const double galon_in_foot=7.481; // galons per cubic foot
& float input_galons=0.0; & //entered amount in galons
& float output_foot=0.0; //outputing amount in cubic feet
& printf("Enter the amount in galons\n"); //request for input
& scanf("%f", &input_galons); //inputting
& output_foot=input_galons/galon_in_foot; //calculating
& printf("The entered amount is %f in cubic feet\n", output_f oot); //output
& system("PAUSE");
& return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS