Java program to convert centimeters into millimeters

Views: 131   

Following program shows you how to convert centimeters to millimeters.
In this program we get centimeters from user once we get those we need to multiply with 10 so that we get in millimeters

import java.util.Scanner;

public class MathUnitConversions2 {

    public static void main(String[] args) {

        int centimeters;

        Scanner in = new Scanner(System.in);

        System.out.println("Please enter centimeters:");
        centimeters = in.nextInt();

        int millimeters = centimeters * 10;
        System.out.println(millimeters + " Millimeters");

    }
}

Output:

Please enter centimeters:
10
100 Millimeters
On By