int row = scanner.nextInt();
System.out.println("massive dagi ustun sonini kiriting");
int column = scanner.nextInt();
int[][] array = new int[row][column];
var counter = 0;
var min = Math.min(row, column);
var max = Math.max(row, column);
for (int i = 0; i < row; i++) {
for (int j = 0; j < column; j++) {
array[i][j] =-1000+ (int) (Math.random() * 2001);
if (array[i][j] >= min && array[i][j] <= max) {
counter++;
}
}
}
System.out.println(Arrays.deepToString(array));
System.out.println(counter);
}
}
Natija:
Do'stlaringiz bilan baham: |