# Time taken per hour for stoppage of Car

A car travels with an average speed of **S** km/h without any stoppage and with stoppage the speed of car reduces to an average of **S1** km/h. The task is to find the time wasted per hour for the stoppage.

**Examples:**

Input:S = 50, S1 = 30

Output:24 min

Input:S = 30, S1 = 10

Output:40 min

**Approach:** Take the first example,

Speed of car without any stoppage = 50 kmph i.e. 50 km in 60 min.

Speed of car with stoppage = 30 kmph i.e. 30 km in 60 min.Now, if there will be no stoppage then 30 km can be covered in 36 min.

50 km –> 60 min

30 km –> (60 / 50) * 30 = 36 min

but it takes 60 min.

So, time for stoppage per hour is 60 min – 36 min = 24 min.

This can be calculated using the below formula:

Below is the implementation of the above approach:

## C++

`// C++ implementation of the approach ` `#include <bits/stdc++.h> ` `using` `namespace` `std; ` ` ` `// Function to return the time taken ` `// per hour for stoppage ` `int` `numberOfMinutes(` `int` `S, ` `int` `S1) ` `{ ` ` ` ` ` `int` `Min = 0; ` ` ` ` ` `Min = ((S - S1) / ` `floor` `(S)) * 60; ` ` ` ` ` `return` `Min; ` `} ` ` ` `// Driver code ` `int` `main() ` `{ ` ` ` `int` `S = 30, S1 = 10; ` ` ` ` ` `cout << numberOfMinutes(S, S1) << ` `" min"` `; ` ` ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`// Java implementation of the approach ` `import` `java.util.*; ` ` ` `class` `GFG ` `{ ` ` ` `// Function to return the time taken ` `// per hour for stoppage ` `static` `int` `numberOfMinutes(` `int` `S, ` `int` `S1) ` `{ ` ` ` `int` `Min = ` `0` `; ` ` ` ` ` `Min = (` `int` `) (((S - S1) / Math.floor(S)) * ` `60` `); ` ` ` ` ` `return` `Min; ` `} ` ` ` `// Driver code ` `public` `static` `void` `main(String[] args) ` `{ ` ` ` `int` `S = ` `30` `, S1 = ` `10` `; ` ` ` ` ` `System.out.println(numberOfMinutes(S, S1) + ` `" min"` `); ` `} ` `} ` ` ` `// This code is contributed by Princi Singh ` |

*chevron_right*

*filter_none*

## Python3

`# Python3 implementation of the approach ` `import` `math ` ` ` `# Function to return the time taken ` `# per hour for stoppage ` `def` `numberOfMinutes(S, S1): ` ` ` ` ` `Min` `=` `0` `; ` ` ` ` ` `Min` `=` `((S ` `-` `S1) ` `/` `math.floor(S)) ` `*` `60` `; ` ` ` ` ` `return` `int` `(` `Min` `); ` ` ` `# Driver code ` `if` `__name__ ` `=` `=` `'__main__'` `: ` ` ` `S, S1 ` `=` `30` `, ` `10` `; ` ` ` ` ` `print` `(numberOfMinutes(S, S1), ` `"min"` `); ` ` ` `# This code is contributed by Rajput-Ji ` |

*chevron_right*

*filter_none*

## C#

`// C# implementation of the approach ` `using` `System; ` ` ` `class` `GFG ` `{ ` ` ` `// Function to return the time taken ` `// per hour for stoppage ` `static` `int` `numberOfMinutes(` `int` `S, ` `int` `S1) ` `{ ` ` ` `int` `Min = 0; ` ` ` ` ` `Min = (` `int` `) (((S - S1) / ` ` ` `Math.Floor((` `double` `)S)) * 60); ` ` ` ` ` `return` `Min; ` `} ` ` ` `// Driver code ` `public` `static` `void` `Main() ` `{ ` ` ` `int` `S = 30, S1 = 10; ` ` ` ` ` `Console.WriteLine(numberOfMinutes(S, S1) + ` ` ` `" min"` `); ` `} ` `} ` ` ` `// This code is contributed ` `// by Akanksha Rai ` |

*chevron_right*

*filter_none*

**Output:**

40 min

Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: **DSA Self Paced**. Become industry ready at a student-friendly price.

## Recommended Posts:

- Distance between end points of Hour and minute hand at given time
- Distance traveled by Hour and Minute hand in given Time interval
- Maximum time such that absolute difference between hour and minute lies in given range
- Time when minute hand and hour hand coincide
- Time difference between expected time and given time
- Minimum time to reach a point with +t and -t moves at time t
- Calculate the angle between hour hand and minute hand
- Maximum possible time that can be formed from four digits
- Calculate the IST : Indian Standard Time
- How is the time complexity of Sieve of Eratosthenes is n*log(log(n))?
- Check if it is possible to make x and y zero at same time with given operation
- Sieve of Eratosthenes in 0(n) time complexity
- Calculate speed, distance and time
- Probability of reaching a point with 2 or 3 steps at a time
- Time required to meet in equilateral triangle
- To Generate a One Time Password or Unique Identification URL
- Program to find the time remaining for the day to complete
- Space and time efficient Binomial Coefficient
- Time taken by two persons to meet on a circular track
- MakeMyTrip Interview Experience | Set 13 (On-Campus for Full Time)

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.