I need some help with a c program that is supposed to determine the kilometers per liter for 4 tanks of gasoline that a user fills in his/her car.
Here is what I have so far:
Expand|Select|Wrap|Line Numbers
- for(i=1;i<=4;i++)
- {
- printf("/n/nEnter the number of kilometer for tank %d#: ",i);
- scanf("%d", &km);
- printf("Enter the number of liters used by tank %d#: ",i);
- scanf("%f", <);
- res = (float)km / lt;
- printf("*** The kilometers per liter for tank %d# is %.1f", i, res);
- }
- getchar();
- printf("Your overall average kilometers per liter for 4 tanks is /n/n");
- printf("Thanks for using the Sears KPL calculator program.");
- }
Thanks in advance.