-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOuter_Diamond.java
More file actions
23 lines (15 loc) · 861 Bytes
/
Outer_Diamond.java
File metadata and controls
23 lines (15 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class Outer_Diamond{
public static void main(String args[]){
for(int x=0;x<7;x++){ //to iterate the rows
for(int y=0;y<7;y++){ //to iterate the columns
if(x+y>=3 && x+y<=9 && y-x<=3 && y-x>=-3){ //to make the area of the diamond with the equations of the boundary lines
System.out.print("*"); //to print spaces wherever necessary
}
else{
System.out.print(" "); //to print asterisks wherever necessary
}
}
System.out.println(); //to change rows after completion of all columns in a particular row
}
}
}