Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class Main {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int n = scan.nextInt();
- int i = 0;
- //first row
- while (i < n + 1) {
- System.out.print(".");
- i++;
- }
- i = 0;
- while (i < n * 2 + 1) {
- System.out.print("_");
- i++;
- }
- i = 0;
- while (i < n + 1) {
- System.out.print(".");
- i++;
- }
- System.out.println();
- //rows after first row
- int leftDots = n;
- int underscore = n * 2 - 1;
- int rightDots = n;
- int l = n * 4 - 1;
- int lastRow = n - 1;
- int rows = 0;
- while (rows < n) {
- i = 0;
- while (i < leftDots) {
- System.out.print(".");
- i++;
- }
- System.out.print("//");
- i = 0;
- while (i < underscore) {
- System.out.print("_");
- i++;
- }
- System.out.print("\\\\");
- i = 0;
- while (i < rightDots) {
- System.out.print(".");
- i++;
- }
- System.out.println();
- leftDots--;
- rightDots--;
- underscore += 2;
- rows++;
- }
- //mid
- System.out.print("//");
- i = 0;
- while (i < (underscore - 5) / 2) {
- System.out.print("_");
- i++;
- }
- System.out.print("STOP!");
- i = 0;
- while (i < (underscore - 5) / 2) {
- System.out.print("_");
- i++;
- }
- System.out.print("\\\\");
- System.out.println();
- //last rows
- rows =0;
- while (rows < n) {
- i = 0;
- while (i < leftDots) {
- System.out.print(".");
- i++;
- }
- System.out.print("\\\\");
- i = 0;
- while (i < underscore) {
- System.out.print("_");
- i++;
- }
- System.out.print("//");
- i = 0;
- while (i < rightDots) {
- System.out.print(".");
- i++;
- }
- System.out.println();
- leftDots++;
- rightDots++;
- underscore -= 2;
- rows++;
- }
- }
- }
Add Comment
Please, Sign In to add comment