Skip to content

Commit

Permalink
Solution for printing letter Z
Browse files Browse the repository at this point in the history
  • Loading branch information
Vedansh-Keshari committed Oct 8, 2021
1 parent 075d88e commit be2c7ae
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 be2c7ae

Please sign in to comment.