Given an integer n which is the number of hours, the task is to convert it into minutes and seconds.
Output: Minutes = 300, Seconds = 18000
Output: Minutes = 120, Seconds = 7200
- h hours = h * 60 minutes as 1 hour = 60 minutes.
- Similarly h hours = h * 3600 seconds.
Note: To convert m minutes back into hours, do n / 60 and for s seconds s / 3600.
Below is the implementation of the above approach:
Minutes = 300, Seconds = 18000
Time Complexity : O(1)
- Converting seconds into days, hours, minutes and seconds
- Python program to convert seconds into hours, minutes and seconds
- Program to find the time after K minutes from given time
- How to create and deploy your portfolio in under 10 minutes
- Total money to be paid after traveling the given number of hours
- Count of a, b & c after n seconds for given reproduction rate
- PHP | Converting string to Date and DateTime
- Program to convert centimeter into meter and kilometer
- Java Program to Convert Binary Code Into Equivalent Gray Code Using Recursion
- Java Program to Check Array Bounds while Inputing Elements into the Array
- Java Program to Convert Celsius into Fahrenheit
- Java Program to Convert Fahrenheit into Celsius
- Partition into two subarrays of lengths k and (N - k) such that the difference of sums is maximum
- Dividing a Large file into Separate Modules in C/C++, Java and Python
- Find the number of ways to divide number into four parts such that a = c and b = d
- Divide Matrix into K groups of adjacent cells having minimum difference between maximum and minimum sized groups
- Convert given time into words
- Encrypt a string into the Rovarspraket (The Robber Language)
- Puzzle | 3 cuts to cut round cake into 8 equal pieces
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.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.