Advertisement
Spocoman

08. Sunglasses

Sep 26th, 2024
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.84 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var n int
  7.     fmt.Scanln(&n)
  8.    
  9.      for i := 0; i < n; i++ {
  10.         currentRow := ""
  11.         for j := 0; j < n * 2; j++ {
  12.             if i != 0 && i != n - 1 && j != 0 && j != n * 2 - 1 {
  13.                 currentRow += "/"
  14.             } else {
  15.                 currentRow += "*"
  16.             }
  17.         }
  18.  
  19.         for k := 0; k < n; k++ {
  20.             x := " "
  21.             if (i == n / 2 && n % 2 == 1 ) || ( i + 1 == n / 2 && n % 2 == 0) {
  22.                 x = "|"
  23.             }
  24.             currentRow += x
  25.         }
  26.  
  27.         for j := 0; j < n * 2; j++ {
  28.             if i != 0 && i != n - 1 && j != 0 && j != n * 2 - 1 {
  29.                 currentRow += "/"
  30.             } else {
  31.                 currentRow += "*"
  32.             }
  33.         }
  34.         fmt.Println(currentRow)
  35.      }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement