Go Program to Print Hollow Right Angled Triangle Star Pattern

Write a Go program to print the hollow right angled triangle star pattern using for loop. 

package main

import "fmt"

func main() {

	var i, j, row int

	fmt.Print("Enter Hollow RightTriangle Star Rows = ")
	fmt.Scanln(&row)

	fmt.Println("Hollow Right Angled Triangle Star Pattern")

	for i = 1; i <= row; i++ {
		for j = 1; j <= i; j++ {
			if i == 1 || i == row || j == 1 || j == i {
				fmt.Printf("*")
			} else {
				fmt.Printf(" ")
			}
		}
		fmt.Println()
	}
}
Go Program to Print Hollow Right Angled Triangle Star Pattern

This Go example prints the hollow right angled triangle pattern of a given character.

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {

	reader := bufio.NewReader(os.Stdin)

	var i, j, row int

	fmt.Print("Enter Hollow Right Triangle Star Rows = ")
	fmt.Scanln(&row)

	fmt.Print("Character to Print in Hollow Right Triangle = ")
	ch, _, _ := reader.ReadRune()

	fmt.Println("Hollow Right Angled Triangle Star Pattern")

	for i = 1; i <= row; i++ {
		for j = 1; j <= i; j++ {
			if i == 1 || i == row || j == 1 || j == i {
				fmt.Printf("%c", ch)
			} else {
				fmt.Printf(" ")
			}
		}
		fmt.Println()
	}
}
Enter Hollow Right Triangle Star Rows = 15
Character to Print in Hollow Right Triangle = #
Hollow Right Angled Triangle Star Pattern
#
##
# #
#  #
#   #
#    #
#     #
#      #
#       #
#        #
#         #
#          #
#           #
#            #
###############