Advertisement
Spocoman

Perfect Diamond

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