Developpement/23DEV1.1/TPS2/TP01/Introduction/Grille.java

23 lines
445 B
Java

public class Grille {
public static void main(String[] args) {
int n = Integer.parseInt(args[0]);
for(int i = 0 ; i<n ; i++){
for(int j = 0 ; j<n ; j++){
if(i%2==0){
System.out.print("+-");
}else{
System.out.print("| ");
}
}
if(i%2==0){
System.out.println("+");
}else{
System.out.println("|");
}
}
for(int j = 0 ; j<n ; j++){
System.out.print("+-");
}
System.out.println("+");
}
}