No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
[CODE]import java.util.* public class ArrayMinMax { public static void main(String[] args) { Integer[] numbers={8,2,6,7,1,4,9,5,3}; int min=(int)Collections.min(Arrays.asList(numbers)); int max=(int)Collections.max(Arrays.asList(numbers)); System.out.println("Min number: "+min); System.out.println("Max number: "+max); } }[/CODE] Hi guys, me again. Okay so I use this code in a single array if i want to know what the minimum and maximum … |
|
Here's my problem. I need to add only the first and last elements of each row, and display them separately. Ex. Row 0=11 Row 1=11 Row 2=8 [CODE]int arr[][]={{5,9,6},{3,2,8},{7,0,1}}; int sum=0; for(int row=0;row<arr.length;row++){ for(int col=0;col<arr[row].length;col++) sum=arr[row][col]+ arr[row][col]; System.out.println(sum+" ");[/CODE] this is my code, and i think i just need some … |