Skip to content

Commit

Permalink
Merge pull request #334 from Vedansh-Keshari/Vedansh123
Browse files Browse the repository at this point in the history
Solution for printing letter Z
  • Loading branch information
SarthakKeshari authored Oct 8, 2021
2 parents 0128197 + be2c7ae commit c9e0e08
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Pattern_Printing/Z.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Write a program to print letter Z exactly
class Z{
public static void main(String args[]){


for(int x=0;x<8;x++){ //for iteration of lines from top to bottom
for(int y=0;y<9;y++){ //for iteration of lines from left to right
if(x==0 || x==7){
System.out.print("@"); //to print @ where necessary
}
else if(x+y==7 || x+y==8){
System.out.print("#"); //to print # where necessary
}
else{
System.out.print(" "); //to print spaces where necessary
}
}
System.out.println();
}
}
}

0 comments on commit c9e0e08

Please sign in to comment.