Java program to convert hours to minutes

Views: 1349   

Following program shows you how to convert hours to minutes.
In this program we get hours from user once we get those we need to multiply with 60 so that we get in minutes

import java.util.Scanner;

public class MathUnitConversions14 {

    public static void main(String[] args) {

        long hours;

        Scanner in = new Scanner(System.in);

        System.out.println("Please enter hours:");

        hours = in.nextLong();
        long minutes = hours * 60;

        System.out.println(minutes + " Minutes");

    }
}

Output:

Please enter hours:
3
180 Minutes
On By