Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class House {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- int n = input.nextInt();
- String dots = new String(new char[n / 2]).replace("\0", ".");
- String star = "*";
- System.out.println(dots + star + dots);
- for (int i = 0; i < (n / 2) - 1; i++) {
- dots = new String(new char[((n / 2) - 1) - i]).replace("\0", ".");
- String midleDots = new String(new char[n - 2 - 2 * ((n / 2) - 1 - i)]).replace("\0", ".");
- System.out.println(dots + star + midleDots + star + dots);
- }
- System.out.println(new String(new char[n]).replace("\0", "*"));
- int wall = n / 4;
- for (int i = 0; i < (n / 2) - 1; i++) {
- dots = new String(new char[wall]).replace("\0", ".");
- String midleDots = new String(new char[n - 2 * wall - 2]).replace("\0", ".");
- System.out.println(dots + star + midleDots + star + dots);
- }
- star = new String(new char[n - 2 * wall]).replace("\0", "*");
- System.out.println(dots + star + dots);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement