Go Program to Print K Shape Number Pattern

Write a Go program to print the K shape number pattern using for loop.

package main

import "fmt"

func main() {
	var i, j, row int

	fmt.Print("Enter the K Shape Number Pattern Rows = ")
	fmt.Scanln(&row)

	fmt.Println("**** K Shape Number Pattern ****")

	for i = row; i >= 1; i-- {
		for j = 1; j <= i; j++ {
			fmt.Printf("%d ", j)
		}
		fmt.Println()
	}

	for i = 2; i <= row; i++ {
		for j = 1; j <= i; j++ {
			fmt.Printf("%d ", j)
		}
		fmt.Println()
	}
}
Go Program to Print K Shape Number Pattern