Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
691 B
0
Indexable
Never
import java.util.Scanner;

public class cmtoinch {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        
        System.out.println("Enter value in centimeters: ");
        double centimeter = sc.nextDouble();
        
        double inch = centimeter / 2.54;
        System.out.println(centimeter + " centimeters is " + inch + " inches");
        
        double meters = centimeter / 100;
        System.out.println(centimeter + " centimeters is " + meters + " meters");
        
        double kilometer = centimeter / 100000;
        System.out.println(centimeter + " centimeters is " + kilometer + " kilometers");
    }
}
Leave a Comment