Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class зада {
- 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();
- // second row
- int dots = n;
- int underscore = n * 2 - 1;
- int rows = 0;
- while (rows < n) {
- i = 0;
- while (i < dots) {
- System.out.print(".");
- i++;
- }
- System.out.print("//");
- i = 0;
- while (i < underscore) {
- System.out.print("_");
- i++;
- }
- System.out.print("\\\\");
- i = 0;
- while (i < dots) {
- System.out.print(".");
- i++;
- }
- System.out.println();
- dots--;
- underscore += 2;
- rows++;
- }
- // STOP!
- 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.println("\\\\");
- //last row
- dots = 0;
- rows = 0;
- int underscore1 = n * 4 - 1;
- while (rows < n) {
- i = 0;
- while (i < dots) {
- System.out.print(".");
- i++;
- }
- System.out.print("\\\\");
- i = 0;
- while (i < underscore1) {
- System.out.print("_");
- i++;
- }
- System.out.print("//");
- i = 0;
- while (i < dots) {
- System.out.print(".");
- i++;
- }
- System.out.println();
- dots++;
- underscore1-=2;
- rows++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment