DEV/DEV2.1/TP0:Introduction/Grille.java

24 lines
459 B
Java
Raw Permalink Normal View History

2023-02-13 11:29:17 +01:00
public class Grille{
public static void main(String[] args) {
int n = Integer.parseInt(args[0]);
for(int i=0;i<=2*n;i++){
if(i%2==0){
for(int j=0;j<=2*n;j++){
if(j%2==0){
System.out.print("+");
} else {
System.out.print("-");
}
}
} else {
for(int j=0;j<=2*n;j++){
if(j%2==0){
System.out.print("|");
} else {
System.out.print(" ");
}
}
} System.out.println("");
}
}
}