Skip to content
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.

diamonnd shape pattern #411

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Java/diamondshapepattern.java
Original file line number Diff line number Diff line change
@@ -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();
}
}
}