Go Program to Print Triangle Alphabets Pattern

Write a Go program to print triangle alphabets pattern using for loop.

package main

import "fmt"

func main() {

	var i, j, k, row, alphabet int

	fmt.Print("Enter Triangle Alphabets Pattern Rows = ")
	fmt.Scanln(&row)

	fmt.Println("**** Triangle Alphabets Pattern ****")

	for i = 0; i < row; i++ {
		alphabet = 65
		for j = row; j > i; j-- {
			fmt.Printf(" ")
		}
		for k = 0; k <= i; k++ {
			fmt.Printf("%c ", alphabet+k)
		}
		fmt.Println()
	}
}
Go Program to Print Triangle Alphabets Pattern

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.