Advertisement
Spocoman

05. Square Frame

Sep 25th, 2024 (edited)
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.37 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.         angleChar := "|"
  11.         if i == 0 || i == n - 1 {
  12.             angleChar = "+"
  13.         }
  14.         fmt.Print(angleChar)
  15.         for j := 0; j < n - 2; j++ {
  16.             fmt.Print(" -")
  17.         }
  18.         fmt.Println(" " + angleChar)
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement