Cristiano Magro
2025-10-05 0e284a3b0e031f2c6d59b12112df1a6c3bc5b289
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();
        }
    }
}