From be2c7ae38827654d20637788e87c3df17a820f18 Mon Sep 17 00:00:00 2001 From: Vedansh-Keshari Date: Fri, 8 Oct 2021 13:06:01 +0530 Subject: [PATCH] Solution for printing letter Z --- Pattern_Printing/Z.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Pattern_Printing/Z.java diff --git a/Pattern_Printing/Z.java b/Pattern_Printing/Z.java new file mode 100644 index 0000000..1d6aa43 --- /dev/null +++ b/Pattern_Printing/Z.java @@ -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(); + } + } +} \ No newline at end of file