How to convert inches to centimeters in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        double inch = 5;
        
        double centimeter = inch * 2.54;

        System.out.println("Inches = " + centimeter);
    }
}



    
/*
run:
    
Inches = 12.7
    
*/

 



answered Sep 11, 2021 by avibootz

Related questions

1 answer 255 views
1 answer 110 views
1 answer 116 views
1 answer 141 views
141 views asked Sep 11, 2021 by avibootz
1 answer 139 views
1 answer 193 views
1 answer 182 views
182 views asked Sep 11, 2021 by avibootz
...