Berikut Ini Script Menggurutkan Dengan Array

Berikut Ini Script Menggurutkan Dengan Array


package javaapplication6; 

import java.io.BufferedReader; 
import java.io.InputStreamReader; 
/** 

* @author Ridho 
*/ 
public class Main { 

/** 
* @param args the command line arguments 
*/ 
public static void main(String[] args) { 
// TODO code application logic here 
BufferedReader dataIn = new BufferedReader(new InputStreamReader(System.in)); 
int[] nilai = new int[3]; 
int max = 0; 
int min = 1000; 
int x=0; 

for (x=0;x<=2;x++) 

System.out.print(“Masukkan Angka ke ” + (x+1) + “: “); 
try { 
nilai[x]=Integer.valueOf(dataIn.readLine()); 
} catch (Exception e) { 
System.out.print(“Error”); 



for (int a = 0; a <=2; a++) 

if (nilai[a] > max) { 
max = nilai[a]; 

if (nilai[a] < min) 

min = nilai[a]; 



System.out.println(“Nilai Maksimum : ” + max); 
System.out.println(“Nilai Minimun : ” + min); 


}

Source :http://basslink.blogspot.com

Leave a Comment

Your email address will not be published. Required fields are marked *