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
How append a slice to an existing slice in Golang?
Struct Instantiation Using Pointer Address Operator
GO Program to Find LCM and GCD of given two numbers
Pascal triangle in Go Programming Language
Top Programming Languages Behind Blockchain App Development
Find Type of Struct in Go Programming Language
Expected <type>, but got <type> error in Golang
Golang write CSV records
Write string slice line by line to a text file
Empty Interface Type in Go Programming Language