Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.out.println("Введите количество строк в таблице: ");
- int x = sc.nextInt();
- System.out.println("Введите количество столбцов в таблице: ");
- int y = sc.nextInt();
- int[][] arr = new int[x][y];
- int a = 0;
- int b = 0;
- while (a < arr.length) {
- arr[a][b] = a * b;
- b++;
- if (b >= y) {
- b = 0;
- a++;
- }
- }
- for (int k = 0; k < x; k++) {
- for (int m = 0; m < y; m++) {
- System.out.print(arr[k][m] + " ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment