the distance between two cities (in km is input through the keyboard. write a program to convert and print this distance in meter ,feet inches and centimeter.
11 . The distance between two cities (in km is input through the keyboard. write a program to convert and print this distance in meter ,feet inches and centimeter. package com.company ; import java.util.Scanner ; public class Main { public static void main ( String [] args ) { // write your code here System . out . print ( "Enter distance between two cities : " ); Scanner sc = new Scanner ( System . in ); //sc is scanner name double distance , meter , feet , inches , centimetres ; //variable is declared distance = sc . nextDouble (); //taking input from user (in km) meter = distance * 1000 ; //1km = 1000m feet = distance * 3280.8399 ; //1km = 3280.8399; inches = distance * 39370.0787 ; //1km = 39370.0787; centimetres = distance * 100000 ; //1km = 100000; System . out . println ( distance + " kilometer = " + meter + " meter" ); System . out . println ( distance + " k...
Comments
Post a Comment