Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class stop {
- public static String repeatStr(String symbol, int n) {
- String text = "";
- for (int i = 0; i < n; i++) {
- text = text + symbol;
- }
- return text;
- }
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- int n = input.nextInt();
- int dots = n+1;
- int underScores = 2*n +1;
- System.out.printf("%s%s%s", repeatStr(".",dots),repeatStr("_", underScores),repeatStr(".", dots) );
- System.out.println();
- for(int i = 0; i<n; i++ ){
- System.out.printf("%s//%s\\\\%s", repeatStr(".",dots-1),repeatStr("_", underScores-2),repeatStr(".", dots-1) );
- System.out.println();
- underScores +=2;
- dots --;
- }
- System.out.printf("//%sSTOP!%s\\\\", repeatStr("_",(underScores-6)/2), repeatStr("_",(underScores-6)/2));
- System.out.println();
- for(int i = 0; i<n; i++ ){
- System.out.printf("%s\\\\%s//%s", repeatStr(".",dots-1),repeatStr("_", underScores-2),repeatStr(".", dots-1) );
- System.out.println();
- underScores -=2;
- dots ++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement