Write a program to read distance in miles and print in kilometre. (1mile=1.609 km)
Answers
Answered by
1
Answer:
import java.util.Scanner;
public class Distance
{
public static void main(String args[])
{
Scanner bp = new Scanner(System.in) ;
System.out.println("Enter the distance in miles, which you want to be converted to kilometers ") ;
double mile = bp.nextDouble();
double km = 1.609 * mile;
System.out.println("Miles = "+mile) ;
System.out.println(" Kilometers = "+km) ;
}
}
NOTE: THIS PROGRAM IS WRITTEN USING THE PROGRAMMING LANGUAGE JAVA
INPUT and OUTPUT:
Enter the distance in miles,
which you want to be converted to kilometers
1000
Miles = 1000
Kilometers = 1609
#bal
#answerwithquality
Similar questions