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 for n-th even number
- Program for n-th odd number
- Program to calculate the value of sin(x) and cos(x)
- Program to find sum of 1 + x/2! + x^2/3! +...+x^n/(n+1)!
- C++ Program for QuickSort
- Program for sum of cos(x) series
- C++ Program for ShellSort
- Program for EMI Calculator
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.