A boat takes N1 hr to row a bot X1 km downstream of a river and take N2 hr to cover a distance of X2 km upstream. Find the speed of the stream.
Input: 3 15 2 5 Output: 17.5 km/hr Input: 4 29 7 30 Output: 47 km/hr
- Take input from users
- Calculate the rate of downstream and upstream. The rate can be calculated using the formula.
- Then, calculate the speed of the stream. It is given by the formula –
Below is the implementation.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.