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
Example of Fscan, Fscanf, and Fscanln from FMT Package
How to remove multiple spaces in a string in GoLang?
GO Program to Generate Multiplication Table
3 Different Examples - How State Works in React?
Struct Instantiation Using Pointer Address Operator
Different ways for Integer to String Conversions