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
Example: How to use ReadAtLeast from IO Package in Golang?
Golang program for implementation of Floyd–Warshall Algorithm
GO language program with example of Sort Functions for integer, strings and float64 data type
Print inverted full pyramid using star
Program in Go language to print Pascal's Triangle
How to copy one slice items into another slice in Golang?