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
- C Hello World Program
- Program to calculate age
- Program to calculate value of nCr
- C++ Program for ShellSort
- Program for EMI Calculator
- C Program for ID3 Tagging
- C Program to Add two Integers
- Program for n-th odd 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 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.