Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package yuhu;
- import java.util.Scanner;
- /**
- *
- * @author Yessy
- */
- public class Yuhu {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- Scanner in = new Scanner (System.in);
- int jumlah;
- System.out.print("Masukkan jumlah angka: ");
- jumlah = in.nextInt();
- double [] angka = new double[jumlah];
- for (int i=0; i<angka.length; i++){
- System.out.print((i+1)+"." + "Angka: ");
- angka[i] = in.nextDouble();
- }
- System.out.println("-----------------------------------");
- System.out.println("Last Number = " + angka[angka.length-1]);
- for (int i=0; i<angka.length; i++){
- System.out.println("Element" + " " + i + " " + angka[i] + " differate with" + " " +angka[angka.length-1]+ " is: ");
- System.out.println(angka[i] - angka[angka.length-1]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement