Skip to content

Commit a85755e

Browse files
Create Test 1:Zeros and Stars Pattern
1 parent 73fbd16 commit a85755e

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Test 1:Zeros and Stars Pattern

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import java.util.Scanner;
2+
public class Solution {
3+
4+
public static void main(String[] args) {
5+
Scanner s=new Scanner(System.in);
6+
int n=s.nextInt();
7+
8+
int k,l;
9+
for(k=1;k<=n;k++){
10+
for(l=1;l<=n;l++){
11+
if(k==l)
12+
System.out.print("*");
13+
else
14+
System.out.print("0");
15+
}
16+
l--;
17+
System.out.print("*");
18+
while(l>=1){
19+
if(k==l)
20+
System.out.print("*");
21+
else
22+
System.out.print("0");
23+
l--;
24+
}
25+
System.out.println("");
26+
}
27+
}
28+
}
29+
30+

0 commit comments

Comments
 (0)