Skip to content

Instantly share code, notes, and snippets.

@sugiartocokrowibowo
Created October 4, 2017 12:56
Show Gist options
  • Save sugiartocokrowibowo/12b873480b54efe79a2f1095ff9467cc to your computer and use it in GitHub Desktop.
Save sugiartocokrowibowo/12b873480b54efe79a2f1095ff9467cc to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class I {
/**
* @param args
*/
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("INPUT");
System.out.print("n : ");
int n = s.nextInt();
double[]data = new double[n];
double MIN = Double.MAX_VALUE;
int index = -1;
for(int i=0;i<n;i++){
System.out.print("elemen ["+i+"]: ");
data[i]=s.nextDouble();
if(data[i]<MIN){
MIN = data[i];
index = i;
}
}
System.out.println("\nOUTPUT");
System.out.println("MIN: "+MIN);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment