Cristiano Magro
2025-10-05 12a2fa369bebf06753654ae56d607465419b0553
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public class BandMatrix {
    public static void main(String[] args) {
        int n = Integer.parseInt(args[0]);
        int distanza = Integer.parseInt(args[1]);
 
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (Math.abs(i - j) <= distanza) {
                    System.out.print("*  ");
                } else {
                    System.out.print("0  ");
                }
            }
            System.out.println();
        }
    }
}