Pages

Thursday, October 21, 2010

LITER TO GALLON

A liter is 0.264197 gallons. Read the number of liters consumed by the car and the number of miles traveled. Then output the no. of miles per gallon the car delivered.


#include<stdio.h>
#include<conio.h>

int main(void)
{
    float Liter,MilesT,gallon,Miles_gallon;

    clrscr();
    printf("Enter the liters that was consumed:");
    scanf("%f",&Liter);
    printf("Enter the Miles that was traveled:");
    scanf("%f",&MilesT);

    gallon =Liter*0.264197;
    Miles_gallon =MilesT/gallon;

    printf("The number of miles per gallon is: %.2f",Miles_gallon);
    getch();
}

No comments:

Post a Comment