package p05_petle;

import java.util.Scanner;

public class TabliczkaMnozeniaUser {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		System.out.print("Podaj liczbę wierszy: ");
		int W = scanner.nextInt();
		System.out.print("Podaj liczbę kolumn: ");
		int K = scanner.nextInt();
		
		final String format = String.format("%%%dd ", String.valueOf((long)W*K).length());

		for(int w = 1; w <= W; w++) {
			for(int k = 1; k <= K; k++) {
				System.out.printf(format, (long)w*k);
			}
			System.out.println();
		}
	}

}
