diff --git a/JAVA/HollowDiammond.java b/JAVA/HollowDiammond.java new file mode 100644 index 0000000..f6798a7 --- /dev/null +++ b/JAVA/HollowDiammond.java @@ -0,0 +1,36 @@ +public class hollow { + public static void main(String[] args){ + Scanner sc=new Scanner(System.in); + int n=sc.nextInt(); + +// upper half of the pattern + for(int i=1;i<=n;i++){ + + for(int j=n-i;j>=0;j--){ + System.out.print("*"); + } + + for(int k=2*(i-1);k>0;k--){ + System.out.print(" "); + } + for(int l=n-i;l>=0;l--){ + System.out.print("*"); + } + System.out.println(); + } +//lower half of the pattern + for(int i=0;i0;k--){ + System.out.print(" "); + } + for(int m=0;m<=i;m++){ + System.out.print("*"); + } + System.out.println(); + } + } + +}