Program to print full pyramid using star
Example
package main
import "fmt"
func main() {
var rows int = 5
var k int
for i := 1; i <= rows; i++ {
k = 0
for space := 1; space <= rows-i; space++ {
fmt.Print(" ")
}
for {
fmt.Print("* ")
k++
if k == 2*i-1 {
break
}
}
fmt.Println("")
}
}
Output
*
* * *
* * * * *
* * * * * * *
* * * * * * * * *
Most Helpful This Week
GO Program to Check Armstrong Number
How to write backslash in Golang string?
Web Application to generate QR code in Golang
Golang Web Server Example
Golang write CSV records
How to access slice items in Golang?
How to Convert Float to String type in Go?
How to convert Struct fields into Map String?
How To Make an HTTP Server in Golang?
How do you handle HTTP server shutdown gracefully in Go?