Skip to content

Instantly share code, notes, and snippets.

@sugiartocokrowibowo
Created October 4, 2017 12:55
Show Gist options
  • Save sugiartocokrowibowo/95f1a23cb25886f52b864afdee6f4b3c to your computer and use it in GitHub Desktop.
Save sugiartocokrowibowo/95f1a23cb25886f52b864afdee6f4b3c to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class H {
/**
* @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 MAX = Double.MIN_VALUE;
int index = -1;
for(int i=0;i<n;i++){
System.out.print("elemen ["+i+"]: ");
data[i]=s.nextDouble();
if(data[i]>MAX){
MAX = data[i];
index = i;
}
}
System.out.println("\nOUTPUT");
System.out.println("MAX: "+MAX);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment