Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CW150321 {
- public static void main(String[] args) {
- int[][] arr = {
- {5, 2, 3, 7, 12},
- {0, 6, 5, 3, 61},
- {9, 12, 0, 16, 90},
- {12, 45, 2, 13, 5},
- {7, 8, 17, 3, 14}
- };
- for (int i = 0; i < arr.length; i++) {
- float sumRow = 0;
- int max = 0;
- int min = arr[i][0];
- int row = 5;
- for (int j = 0; j < arr[0].length; j++) {
- sumRow = sumRow + arr[i][j];
- if(arr[i][j] > max){
- max = arr[i][j];
- }
- if(arr[i][j] < min){
- min = arr[i][j];
- }
- }
- float avg = sumRow/row;
- System.out.println("--(●'◡'●)--Row " + (i+1) + "--(●'◡'●)--"
- + "\nSum: " + sumRow
- + "\nMaximum: "+ max
- + "\nMinimum: " + min
- + "\nAverage: " + String.format("%.2f", avg));
- }
- }
- }
Add Comment
Please, Sign In to add comment