Computer Science, asked by shrutigupta2953, 9 months ago

Car mileage Nanu bought a new car and for the first time, he wants to go to a temple. Without checking how much petrol is available in the car, he started traveling. After reaching a certain distance, he remembered that he didn't check the petrol level of his car. Then he checks the petrol level and calculates how much distance he must travel to reach the destination. Find whether he can reach the destination with the available petrol. Mileage is also known. Display "Can reach" or "Cannot reach" based on the situation.

Answers

Answered by spideyman8200
2

Answer:

#include<iostream>

using namespace std;

int main()

{

 //Type your code here.

 float m;

 int l,d;

 cin>>m>>l>>d;

 float x = m*l;

 if(x < d)

   cout<<"Cannot reach"<<endl;

 else

   cout<<"Can reach"<<endl;

}

Explanation:

Answered by Papul1612
7

#include<iostream>

using namespace std;

int main()

{

 float m;

 int p,d;

 cin>>m>>p>>d;

 if((m*p) >= d)

   cout<<"Can reach";

 else

   cout<<"Cannot reach";

}

Similar questions