Advertisement
Spocoman

02. Rectangle of N x N Stars(with or not strings.Repeat())

Sep 25th, 2024
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.42 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.         for j := 0; j < n; j++ {
  11.             fmt.Print("*")
  12.         }
  13.         fmt.Println()
  14.     }
  15. }
  16.  
  17. ИЛИ:
  18.  
  19. package main
  20.  
  21. import (
  22.     "fmt"
  23.     "strings"
  24. )
  25.  
  26. func main() {
  27.     var n int
  28.     fmt.Scanln(&n)
  29.    
  30.     for i := 0; i < n; i++ {
  31.         fmt.Println(strings.Repeat("*", n))
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement