Java Convert Minutes to Seconds

In this example we will see how to convert minutes to seconds. First we ask how many minutes we want to convert to seconds. Then we use Scanner to get the next integer from the user input. After that we multiply by 60 because every minute have 60 seconds and print the end result.

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        System.out.println("How many minutes?");
        Scanner input = new Scanner(System.in);
        int minutes = input.nextInt();
        int seconds = minutes * 60;
        System.out.println("Answer: " + seconds);
    }
}
How many minutes?
3
Answer: 180

Leave a Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.