Go Program to Print Mirrored Rhombus Star Pattern

Write a Go program to print the mirrored rhombus star pattern using for loop. 

package main

import "fmt"

func main() {

	var i, j, k, row int

	fmt.Print("Enter Mirrored Rhombus Star Pattern Rows = ")
	fmt.Scanln(&row)

	fmt.Println("Mirrored  Rhombus Star Pattern")

	for i = 1; i <= row; i++ {
		for j = 1; j < i; j++ {
			fmt.Printf("  ")
		}
		for k = 1; k <= row; k++ {
			fmt.Printf("* ")
		}
		fmt.Println()
	}
}
Go Program to Print Mirrored Rhombus Star Pattern

This Go example prints the mirrored rhombus pattern of a given character.

package main

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

func main() {

	reader := bufio.NewReader(os.Stdin)

	var i, j, k, row int

	fmt.Print("Enter Mirrored Rhombus Pattern Rows = ")
	fmt.Scanln(&row)

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

	fmt.Println("Mirrored Rhombus Pattern")

	for i = 1; i <= row; i++ {
		for j = 1; j < i; j++ {
			fmt.Printf("  ")
		}
		for k = 1; k <= row; k++ {
			fmt.Printf("%c ", ch)
		}
		fmt.Println()
	}
}
Enter Mirrored Rhombus Pattern Rows = 15
Character to Print in Mirrored Rhombus = $
Mirrored Rhombus 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.