Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class stop {
  4. public static String repeatStr(String symbol, int n) {
  5. String text = "";
  6. for (int i = 0; i < n; i++) {
  7. text = text + symbol;
  8. }
  9. return text;
  10. }
  11. public static void main(String[] args) {
  12. Scanner input = new Scanner(System.in);
  13.  
  14. int n = input.nextInt();
  15.  
  16. int dots = n+1;
  17.  
  18. int underScores = 2*n +1;
  19.  
  20. System.out.printf("%s%s%s", repeatStr(".",dots),repeatStr("_", underScores),repeatStr(".", dots) );
  21. System.out.println();
  22.  
  23. for(int i = 0; i<n; i++ ){
  24. System.out.printf("%s//%s\\\\%s", repeatStr(".",dots-1),repeatStr("_", underScores-2),repeatStr(".", dots-1) );
  25. System.out.println();
  26. underScores +=2;
  27. dots --;
  28. }
  29.  
  30. System.out.printf("//%sSTOP!%s\\\\", repeatStr("_",(underScores-6)/2), repeatStr("_",(underScores-6)/2));
  31. System.out.println();
  32.  
  33.  
  34. for(int i = 0; i<n; i++ ){
  35. System.out.printf("%s\\\\%s//%s", repeatStr(".",dots-1),repeatStr("_", underScores-2),repeatStr(".", dots-1) );
  36. System.out.println();
  37. underScores -=2;
  38. dots ++;
  39. }
  40.  
  41.  
  42.  
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement