-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInscribe.java
More file actions
36 lines (35 loc) · 755 Bytes
/
Inscribe.java
File metadata and controls
36 lines (35 loc) · 755 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
import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
public class Inscribe {
public static void main(String[] args) throws FileNotFoundException
{
Scanner fin = new Scanner(new File("inscribe.dat"));
int num;
int letters;
char[][] matrix;
while(fin.hasNextLine())
{
num = Integer.parseInt(fin.nextLine());
letters = num/2 + 1;
matrix = new char[num][num];
for (int i = 0; i < letters; i++)
{
for (int j = i; j < num-i; j++)
{
for (int k = i; k < num-i; k++)
{
matrix[j][k] = (char)(64 + letters - i);
}
}
}
for (char[] row: matrix)
{
for (char el: row)
System.out.print(el);
System.out.println();
}
System.out.println();
}
}
}