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
- Total money to be paid after traveling the given number of hours
- How to create and deploy your portfolio in under 10 minutes
- Count of a, b & c after n seconds for given reproduction rate
- PHP | Converting string to Date and DateTime
- Program to print Hut
- Program for sum of cos(x) series
- C++ Program for ShellSort
- C++ Program for QuickSort
- Program to calculate value of nCr
- Program to wish Women's Day
- Program for n-th odd number
- Program for n-th even number
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.