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
GO Program to Find the Largest Number Among Three Numbers
GO Program to Swap Number Without Using Temporary Variables
GO Program to Check Whether a Number is Even or Odd
GO Program to take user input and addition of two strings
GO language program with example of Sort Functions for integer, strings and float64 data type
GO language program with example of String Compare function