-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA8P16.java
More file actions
53 lines (51 loc) · 732 Bytes
/
A8P16.java
File metadata and controls
53 lines (51 loc) · 732 Bytes
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
class A8P16
{
public static void main(String[] args)
{
int n=5;
int x=1;
char y = 'a';
for (int i=0;i<n ;i++ )
{
int a = x;
char b = y;
for (int j =0;j<n ;j++ )
{
if(i+j>=n-1)
{
if (i%2==0)
{
System.out.print(a++);
}
else
{
System.out.print((char)(b++));
}
}
else
{
System.out.print(" ");
}
}
for (int k = 0;k<n ;k++ )
{
if (i>=k+1)
{
if(i%2==0)
{
System.out.print((a--)-2);
}
else
{
System.out.print((char)((b--)-2));
}
}
else
{
System.out.print(" ");
}
}
System.out.println();
}
}
}