We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 77010fd commit 2fcbe81Copy full SHA for 2fcbe81
src/jan4/rough.java
@@ -2,16 +2,17 @@
2
3
public class rough {
4
public static void main(String[] args) {
5
- for(int row=1;row<=5;row++) {
6
- for(int col=1;col<=5;col++) {
7
- if(row+col>=6) {
8
- System.out.print(" * ");
9
- }
10
- else {
11
- System.out.print(" ");
+ int num=5;
+ for(int row=1;row<=num;row++) {
+ for(int col=1;col<=2*num-1;col++) {
+ if((col+row>num && col-row<=num-1)) {
+ System.out.print(" * ");
+ }
+ else {
12
+ System.out.print(" ");
13
14
}
15
+ System.out.println();
16
- System.out.println();
17
18
0 commit comments