View difference between Paste ID: nPYcdg4d and VZs2gT3t
SHOW: | | - or go back to the newest paste.
1
package Exams;
2
3
import java.util.Scanner;
4
5
public class SimpleDrawing {
6
7
	public static void main(String[] args) {
8
		Scanner input = new Scanner(System.in);
9
		int n = input.nextInt();
10
		
11
		int width = n;
12
		char symbol = '*';
13
		char empty = '.';
14
		
15
		for (int i = 0; i < n; i++) {
16
			System.out.print(symbol);
17
		}
18
		System.out.println();
19
		
20
		int stars = n - 2;
21
		int emptySpaces = (n - stars) / 2;
22
		for (int i = 0; i < n / 2; i++) {
23
			System.out.print(DrawFigure(emptySpaces, empty));
24
			System.out.print(DrawFigure(stars, symbol));
25
			System.out.println(DrawFigure(emptySpaces, empty));
26
			stars -= 2;
27
			emptySpaces++;
28
		}
29
		
30
		stars += 2;
31
		emptySpaces--;
32
		
33
		for (int i = 0; i < (n / 2) - 1; i++) {
34
			stars += 2;
35
			emptySpaces--;
36
			System.out.print(DrawFigure(emptySpaces, empty));
37
			System.out.print(DrawFigure(stars, symbol));
38
			System.out.println(DrawFigure(emptySpaces, empty));
39
		}
40
		for (int i = 0; i < n; i++) {
41
			System.out.print(symbol);
42
		}
43
	}
44
	public static char DrawFigure(int n, char symbol) {
45
		
46
		for (int i = 0; i < n - 1; i++) {
47
			System.out.print(symbol);
48
		}
49
		return symbol;
50
	}
51
52
}