write a program to get input distance and print fare for passengers according to. DISTANCE FARE (in Rs). Up To 20km 10 per km. Next 20 km 7 per km. Above 6 per km. answer fast please
Answers
Answered by
1
Given : DISTANCE FARE (in Rs). Up To 20km 10 per km. Next 20 km 7 per km. Above 6 per km.
To Find : write a program to get input distance and print fare for passengers
Solution:
Input
float d , f
d = distance in km
f = fare in Rs
if ( d ≤ 20 )
{
f = 10 x d
}
elseif ( d ≤ 40 )
{
f = 200 + 7 x (d - 20)
}
else
{
f = 340 + 6 x ( d - 40)
}
Print f
Learn More:
Write a a algorithm for a program that adds two digits numbers ...
https://brainly.in/question/14599411
write a program to sum the given sequences 1^2+3^2+5^2+n^2 ...
https://brainly.in/question/17500988
Similar questions