Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package _03_SoftUni;
- import java.util.Scanner;
- public class NewHouse {
- public static void main(String[] args) {
- Scanner inputScanner = new Scanner(System.in);
- int n = inputScanner.nextInt();
- int outerDots = n / 2;
- int innerDots = 1;
- for (int i = 0; i < n / 2 + 1; i++) {
- print(outerDots, '-');
- print(innerDots, '*');
- print(outerDots, '-');
- innerDots += 2;
- outerDots--;
- System.out.println();
- }
- for (int i = 0; i < n; i++) {
- System.out.print("|");
- print(n-2, '*');
- System.out.println("|");
- }
- }
- public static void print(int n, char ch) {
- for (int j = 0; j < n; j++) {
- System.out.print(ch);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement