Write a program that calculates the number of km per gallon the car gets. Using c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Write a program that calculates the number of km per gallon the car gets. Using c++

Kilometer per gallon- A car holds 16 gallons of petrol and can travel 350kilometers before refueling. Write a program that calculates the number of km per gallon the car gets.

9th Dec 2016, 9:45 AM
Home Boui
Home Boui - avatar
2 Answers
0
#include <iostream> using namespace std; int main(){ const int max_gallons=16, max_km=350; cout<<"the number of km per gallon is "<<max_km/max_gallons<<" km/gal"<<endl; }
9th Dec 2016, 12:01 PM
Jack Willson
Jack Willson - avatar
0
Is it right
23rd Jul 2021, 7:48 AM
Pari Shaw