The following formula is used to calculate between three values:
-Distance in Kilometer, KM
- Time in Hour, H
-Speed in KM/H
Determine the car’s speed based on the related input value using the following table. using selection.
speed indicator
<=110 KM/H okay
>110 KM/H fast
#include<iostream>
using namespace std;
void main()
{
float speed,distance,time;
cout<<"enter the distance (km)";
cin>>distance;
cout<<"enter the time(t)";
cin>>time;
speed=distance/time;
cout<<"speed is"<<speed;
if(speed<=110)
{
cout<<"OKAY";
}
elseif(speed>110)
{
cout<<"fast";
}
}
Comments
Leave a comment