Advertisement
Spocoman

Draw Fort

Oct 6th, 2024
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.64 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.   "fmt"
  5.   "strings"
  6. )
  7.  
  8. func main() {
  9.     var n, x int
  10.     fmt.Scanln(&n)
  11.    
  12.     if n > 4 {
  13.         x =  n * 2 - (n / 2 + 2) * 2
  14.     }
  15.  
  16.     fmt.Printf("/%s\\%s/%s\\\n", strings.Repeat("^", n / 2), strings.Repeat("_", x), strings.Repeat("^", n / 2))
  17.  
  18.     for i := 0; i < n - 3; i++ {
  19.         fmt.Printf("|%s|\n", strings.Repeat(" ", n * 2 - 2))
  20.     }
  21.  
  22.     fmt.Printf("|%s%s%s|\n", strings.Repeat(" ", (n * 2 - (x + 2)) / 2), strings.Repeat("_", x), strings.Repeat(" ", (n * 2 - (x + 2)) / 2))
  23.  
  24.     fmt.Printf("\\%s/%s\\%s/\n", strings.Repeat("_", n / 2), strings.Repeat(" ", x), strings.Repeat("_", n / 2))
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement