Skip to content

Commit c9e0e08

Browse files
Merge pull request #334 from Vedansh-Keshari/Vedansh123
Solution for printing letter Z
2 parents 0128197 + be2c7ae commit c9e0e08

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Pattern_Printing/Z.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Write a program to print letter Z exactly
2+
class Z{
3+
public static void main(String args[]){
4+
5+
6+
for(int x=0;x<8;x++){ //for iteration of lines from top to bottom
7+
for(int y=0;y<9;y++){ //for iteration of lines from left to right
8+
if(x==0 || x==7){
9+
System.out.print("@"); //to print @ where necessary
10+
}
11+
else if(x+y==7 || x+y==8){
12+
System.out.print("#"); //to print # where necessary
13+
}
14+
else{
15+
System.out.print(" "); //to print spaces where necessary
16+
}
17+
}
18+
System.out.println();
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)