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
Implementing Multiple Interfaces in Go Programming Language
Golang program for implementation of Longest Common Sub-sequence
GO language program with example of Array Reverse Sort Functions for integer and strings
Creating a Struct Instance Using a Struct Literal
How do you handle HTTP Client server load balancing in Go?
Panic: runtime error: index out of range error in Golang