Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
688 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");
        
        System.out.println("Enter value in meters: ");
        double meters = sc.nextDouble();
        
        double kilometer = meters/1000;
        
        System.out.println(meters + " meters is " + kilometer + " kilometers");
        
        
    }
}

Leave a Comment