print the pattern 1 121 12321 1234321 12321 121 1 DIAMOND Form...JAVA
Answers
Answer:
true
Explanation:
hope it's helps you
Answer: The required Java program is :-
public class Main {
public static void main(String[] args) {
int i,j;
for(i=1;i<=4;i++) {
for (j=1;j<=4-i;j++) {
System.out.print(" ");
}
for(j=1;j<=i;j++) {
System.out.print(j);
}
for(j=i-1;j>=1;j--) {
System.out.print(j);
}
System.out.println();
}
for(i=3;i>=1;i--) {
for(j=1;j<=4-i;j++) {
System.out.print(" ");
}
for(j=1;j<=i;j++) {
System.out.print(j);
}
for(j=i-1;j>=1;j--) {
System.out.print(j);
}
System.out.println();
}
}
}
Note :-
The above program is saved in a file named Main.java
Also, try-catch block can be used to avoid errors.