Advertisement
satriafu5710

Konversi Jarak Km ke Mil Java

Jan 17th, 2022
1,681
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.tutorial;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7.     public static void main(String[] args) {
  8.  
  9.         Scanner userInput = new Scanner(System.in);
  10.  
  11.         double km, hasil;
  12.  
  13.         double mil = 0.621371; // Jarak 1 Km dalam mil
  14.  
  15.         System.out.println("\n\t Konversi Jarak Km ke Jarak mil \n");
  16.  
  17.         System.out.print(" Berapa Km : ");
  18.         km = userInput.nextDouble();
  19.  
  20.         System.out.println("");
  21.  
  22.         hasil = km * mil;
  23.  
  24.         System.out.println(" " + km + " Km = " + hasil + " mil.");
  25.  
  26.         System.out.println("");
  27.     }
  28. }
  29.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement