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("")
}
}
Most Helpful This Week
Find out how many logical processors used by current process
Golang Program to print Triangle of Numbers
How to append struct member dynamically using Empty Interface?
Sierpinski triangle in Go Programming Language
How to declare Interface Type in Go Programming Language
Golang program for implementation of Merge Sort