Computer Science, asked by mishaalmehdi, 3 months ago

Write a program that asks the user to input:

a) The number of gallons of gas in the tank

b) The fuel efficiency in miles per gallon

c) The price of gas per gallon

Then print the cost per 100 miles and how far the car can go with the gas in the tank.

(to be done in python)​

Answers

Answered by santdas36
1

gallons = int(input('enter no of gallons of gas in tank\n'))

efficiency = int(input('enter efficiency of fuel in miles per gallon\n'))

price = int(input('enter price of gas per gallon\n'))

cpm = (100/efficiency) * price

distance = gallons * efficiency

print('Cost per 100 miles: ', cpm)

print('The car can travel', distance , 'miles with', gallons , 'gallons of gas')

Similar questions