SHARE
TWEET

Untitled

a guest Mar 26th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package yuhu;
  7.  
  8. import java.util.Scanner;
  9.  
  10. /**
  11.  *
  12.  * @author Yessy
  13.  */
  14. public class Yuhu {
  15.  
  16.     /**
  17.      * @param args the command line arguments
  18.      */
  19.     public static void main(String[] args) {
  20.         // TODO code application logic here
  21.         Scanner in = new Scanner (System.in);
  22.         int jumlah;
  23.         System.out.print("Masukkan jumlah angka: ");
  24.         jumlah = in.nextInt();
  25.         double [] angka = new double[jumlah];
  26.         for (int i=0; i<angka.length; i++){
  27.             System.out.print((i+1)+"." +  "Angka: ");
  28.             angka[i] = in.nextDouble();
  29.         }
  30.         System.out.println("-----------------------------------");
  31.         System.out.println("Last Number = " + angka[angka.length-1]);
  32.        
  33.         for (int i=0; i<angka.length; i++){
  34.             System.out.println("Element" + " " + i + " " + angka[i] + " differate with" + " " +angka[angka.length-1]+ " is: ");
  35.             System.out.println(angka[i] - angka[angka.length-1]);
  36.            
  37.         }
  38.  
  39.     }
  40.    
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top