Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class minmaxmatrix {
- public static void main(String[] args) {
- int arr[][]= {{3,5,71,56},
- {33,54,312},
- {35,57,71,56,33}
- };
- for(int i = 0;i<arr.length;i++){
- int max = Integer.MIN_VALUE;
- int min = Integer.MAX_VALUE;
- double average = 0;
- double sum = 0;
- for(int j = 0;j<arr[i].length;j++){
- if(max < arr[i][j]){
- max = arr[i][j];
- }
- if(min > arr[i][j]){
- min = arr[i][j];
- }
- sum+=arr[i][j];
- average = sum/arr[i].length;
- }
- System.out.format(min+" "+max+" "+sum+" %.2f", average);
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement