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
Top 20 Most Popular Cryptocurrencies To Watch In 2024
How to add items to Slice using append function in Golang?
Struct Instantiation Using Pointer Address Operator
Golang program for implementation of Pancake Sort
How to set timeout for http.Get() requests in Golang?
Syntax error: unexpected <token> error in Golang