0

Can we use the built-in method 'min' to find the minimum from the numbers (let's say from 6 numbers of an array) in an array?

23rd Jun 2016, 5:56 PM
Nastyusha Ilina
Nastyusha Ilina - avatar
5 Antworten
+ 1
min function is used to find minimum of two operands
23rd Jun 2016, 6:56 PM
neel
neel - avatar
+ 1
but you can build your own method for array or n number of numbers to find the minimum, if you need i can write diwn here
23rd Jun 2016, 6:58 PM
neel
neel - avatar
+ 1
int[] example = {9, 7, 4,8,3,6,19,30}; int min = 10000000000000; for(int number: example){ min = Math.min(min, number); }
23rd Jun 2016, 10:16 PM
michael edia
michael edia - avatar
0
Thanks a lot! I would be very grateful!
23rd Jun 2016, 7:57 PM
Nastyusha Ilina
Nastyusha Ilina - avatar
0
output: 3
23rd Jun 2016, 10:17 PM
michael edia
michael edia - avatar