Go Program to Print Right Arrow Star Pattern

Write a Go program to print the right arrow star pattern using for loop. 

package main

import "fmt"

func main() {

	var i, j, row int

	fmt.Print("Enter Right Arrow Star Pattern row = ")
	fmt.Scanln(&row)

	fmt.Println("Right Arrow Star Pattern")

	for i = 0; i < row; i++ {
		for j = 0; j < row; j++ {
			if j < i {
				fmt.Printf(" ")
			} else {
				fmt.Printf("*")
			}
		}
		fmt.Println()
	}

	for i = 2; i <= row; i++ {
		for j = 0; j < row; j++ {
			if j < row-i {
				fmt.Printf(" ")
			} else {
				fmt.Printf("*")
			}
		}
		fmt.Println()
	}
}
Go Program to Print Right Arrow Star Pattern

This Go example prints the right arrow 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 Right Arrow Star Pattern row = ")
	fmt.Scanln(&row)

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

	fmt.Println("Right Arrow Star Pattern")

	for i = 0; i < row; i++ {
		for j = 0; j < row; j++ {
			if j < i {
				fmt.Printf(" ")
			} else {
				fmt.Printf("%c", ch)
			}
		}
		fmt.Println()
	}

	for i = 2; i <= row; i++ {
		for j = 0; j < row; j++ {
			if j < row-i {
				fmt.Printf(" ")
			} else {
				fmt.Printf("%c", ch)
			}
		}
		fmt.Println()
	}
}
Enter Right Arrow Star Pattern row = 12
Character to Print in Right Arrow = $
Right Arrow Star Pattern
$$$$$$$$$$$$
 $$$$$$$$$$$
  $$$$$$$$$$
   $$$$$$$$$
    $$$$$$$$
     $$$$$$$
      $$$$$$
       $$$$$
        $$$$
         $$$
          $$
           $
          $$
         $$$
        $$$$
       $$$$$
      $$$$$$
     $$$$$$$
    $$$$$$$$
   $$$$$$$$$
  $$$$$$$$$$
 $$$$$$$$$$$
$$$$$$$$$$$$