Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
MinMaxArray
//'main' method must be in a class 'Rextester'. //openjdk version '11.0.5' import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { int[] arr = {1000, 2, 45, 1, 30, 1400}; int min; int max = arr[0]; min = arr[0]; for(int loop:arr){ if(loop<min) min = loop; else if(loop>max) max = loop; } System.out.println(min+" "+max); } }
run
|
edit
|
history
|
help
0
Minimum Vertices to Traverse Directed Graph
Account JAVA Cpa
add static
LinearSearch
Case 2nd Clear
classwork
frequency of char
document
JavaQ5
2