From 2d33c295de353a3e7d0cc025fc3ef62ace214a44 Mon Sep 17 00:00:00 2001 From: sonu kumar <89937675+Sonucoder@users.noreply.github.com> Date: Mon, 10 Oct 2022 20:27:04 +0530 Subject: [PATCH] dimonnd shape pattern Diamond shape pattern print using java --- Java/diamondshapepattern.java | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Java/diamondshapepattern.java diff --git a/Java/diamondshapepattern.java b/Java/diamondshapepattern.java new file mode 100644 index 0000000..336db06 --- /dev/null +++ b/Java/diamondshapepattern.java @@ -0,0 +1,25 @@ +//pattern print dimond shape +import java.util.*; +public class dimondshapepattern{ + public static void main(String args[]){ + int n=4; + for(int i=1;i<=n;i++){ + for(int j=1;j<=n-i;j++){ + System.out.print(" "); + } + for(int j=1;j<=2*i-1;j++){ + System.out.print("*"); + } + System.out.println(); + } + for(int i=n;i>=1;i--){ + for(int j=1;j<=n-i;j++){ + System.out.print(" "); + } + for(int j=1;j<=2*i-1;j++){ + System.out.print("*"); + } + System.out.println(); + } + } +} \ No newline at end of file