VOOZH about

URL: https://www.geeksforgeeks.org/android/program-to-convert-minutes-to-seconds/

⇱ Program to convert minutes to seconds - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Program to convert minutes to seconds

Last Updated : 15 Feb, 2024

Given an integer N, the task is to convert N minutes to seconds.

Note: 1 minute = 60 seconds

Examples:

Input: N = 5
Output: 300 seconds
Explanation: 5 minutes is equivalent to 5 * 60 = 300 seconds

Input: N = 10
Explanation: 600 seconds
Output: 10 minutes is equivalent to 10 * 60 = 600 seconds

Approach: To solve the problem, follow the below idea:

We know that 1 minute is equal to 60 seconds, so to convert N minutes to seconds, we can simply multiply N with 60 to get the total number of seconds.

Step-by-step approach:

  • Take the input as the number of minutes N.
  • Convert minutes to seconds by multiplying N with 60 and store it in ans.
  • Print the final answer as ans.

Below is the implementation of the above approach:


Output
600 seconds

Time Complexity: O(1)
Auxiliary Space: O(1)

Comment
Article Tags:
Article Tags:

Explore