Skip to main content

Posts

Showing posts with the label Class 12th Chapter :- 7 Write a Java program to enter length in centimeter and convert it into meter and kilometer.

ads1

Java Program || Write a Java program to enter length in centimeter and convert it into meter and kilometer.

                                                                                             Java Program  Write a Java program to enter length in centimeter and convert it into meter and kilometer.   Solution :-  meter = cm / 100.0; km    = cm / 100000.0;   Static :-  class convert {     public static void main(String args[])     {         double cm=1000,meter,km;         meter = cm/100.0;         km = cm/100000.0;         System.out.println("The meter :-"+meter);         System.out.println("The Kilometer is :-"+km);              }     } Output :-    Dynamic :-  import java.util.*; class convert {     public static void main(String args[])     {         Scanner in = new Scanner(System.in);         System.out.println("Enter the cm :- ");         int cm = in.nextInt();         double meter = cm/1000.0;         double km = cm/100000.0;         System.out.println("The meter :-"+meter);         System.out.println("The Kilometer is :-"+km);

ads2