Created
October 4, 2017 12:55
-
-
Save sugiartocokrowibowo/95f1a23cb25886f52b864afdee6f4b3c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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