Merged Pattern Printing
1****
12***
123**
1234*
12345
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
public class ajit{
public static void main(String[] args) {
int i, j, k;
int n = 5;
for (i = 1; i <= n; i++) {
for (j = 1; j <= i; ++j)
System.out.print(j);
for (k = n - i; k >= 1; k--)
System.out.print("*");
System.out.println();
}
}
}
|
Comments
Post a Comment