Golang Program to print Triangle of Numbers
Example
package main
import "fmt"
func main() {
var rows = 5
for i := 1; i <= rows; i++ {
for j := 1; j <= i; j++ {
fmt.Printf("%d ", j)
}
fmt.Println()
}
}
Output
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Most Helpful This Week
Golang program for implementation of Tower of Hanoi Algorithm
GO Program to Check Whether a Number is Even or Odd
Goroutines Channels order of execution
Golang read json file into struct
Golang program for implementation of Levenshtein distance
Assign Default Value for Struct Field
How do you handle HTTP server health checks in Go?
Example to compare Println vs Printf
Sierpinski triangle in Go Programming Language
Golang HTTP GET request with parameters