Advertisement
Azazavr

Двумерный массив случайных целых чисел

Feb 28th, 2015
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. /*Создать двумерный массив из 8 строк по 5 столбцов в каждой из
  2. случайных целых чисел из отрезка [10;99]. Вывести массив на экран.
  3.  */
  4. public class DvumerniyMassiv {
  5.     public static void main(String[] args) {
  6.         int[][] m = new int[8][5];
  7.  
  8.         for (int i = 0; i < m.length; i++) {
  9.             for (int j = 0; j <m[i].length ; j++) {
  10.                 m[i][j] = (int) ((Math.random() * 90) +10);
  11.             }
  12.         }
  13.  
  14.         for (int i = 0; i < m.length; i++) {
  15.             System.out.println();
  16.             for (int j = 0; j < m[i].length; j++) {
  17.                 System.out.print(m[i][j] + " ");
  18.  
  19.             }
  20.  
  21.         }
  22.     }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement