logo image

Java program to convert millimeters into centimeters

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

import java.util.Scanner;

public class MathUnitConversions3 {

	public static void main(String[] args) {

		double millimeters;

		Scanner in = new Scanner(System.in);

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

		double centimeters = millimeters / 10;
		System.out.println(centimeters + " Centimeters");




Please enter millimeters:
2.5 Centimeters