File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "java.project.sourcePaths" : [
3+ " Sorting" ,
34 " Number Theory" ,
45 " Basic Codes" ,
5- " Sorting "
6+ " Pattern_Printing "
67 ]
78}
Original file line number Diff line number Diff line change 1+ // Write a program to print a diamond void on a 7 x 7 grid matrix
2+ class Outer_Diamond {
3+ public static void main (String args []){
4+
5+
6+
7+
8+
9+ for (int x =0 ;x <7 ;x ++){ //to iterate the rows
10+ for (int y =0 ;y <7 ;y ++){ //to iterate the columns
11+ 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
12+ System .out .print ("*" ); //to print asterisks wherever necessary
13+ }
14+ else {
15+ System .out .print (" " ); //to print spaces wherever necessary
16+ }
17+ }
18+ System .out .println (); //to change rows after completion of all columns in a particular row
19+ }
20+
21+
22+
23+ }
24+ }
You can’t perform that action at this time.
0 commit comments