Go Program to Print Reverse Mirrored Right Triangle Star Pattern

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

package main

import "fmt"

func main() {

	var i, j, row int

	fmt.Print("Enter Reverse Mirrored Right Triangle Pattern row = ")
	fmt.Scanln(&row)

	fmt.Println("Reverse Mirrored Right Angled Triangle Star Pattern")

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

This Go example prints the mirrored right angled triangle in reverse order 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 Reverse Mirrored Right Triangle Pattern row = ")
	fmt.Scanln(&row)

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

	fmt.Println("Reverse Mirrored Right Angled Triangle Star Pattern")

	for i = 1; i <= row; i++ {
		for j = 1; j <= row; j++ {
			if j < i {
				fmt.Printf("  ")
			} else {
				fmt.Printf("%c ", ch)
			}
		}
		fmt.Println()
	}
}
Enter Reverse Mirrored Right Triangle Pattern row = 15
Character to Print Reverse Mirrored Right Triangle = #
Reverse Mirrored Right Angled Triangle Star 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.