-
Notifications
You must be signed in to change notification settings - Fork 0
/
pattern5.java
33 lines (33 loc) · 870 Bytes
/
pattern5.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.util.Scanner;
public class Numbers{
public static void main(String[] args){
int i,j,l,k,num;
Scanner input=new Scanner(System.in);
num=input.nextInt();
for(i=1;i<=num;i++){
for (k=num-i;k>0;k--){
System.out.print(" ");
}
for(j=1;j<=i;j++){
System.out.print(j);
}
for(l=j-2;l>0;l--){
System.out.print(l);
}
System.out.println();
}
num--;
for(i=0;i<num;i++){
for(k=i;k>=0;k--){
System.out.print(" ");
}
for(j=1;j<=num-i;j++){
System.out.print(j);
}
for(l=j-2;l>0;l--){
System.out.print(l);
}
System.out.println();
}
}
}