GO Program to print full Pyramid using *
Simple program in go language using for...... loop to print the Pyramid of *. Program first ask user to enter number of rows. Then output will be Pyramid of that rows.
Example
package main
import "fmt"
func main() {
var rows int
var k int = 0
fmt.Print("Enter number of rows :")
fmt.Scan(&rows)
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("")
}
}