Kotlin Program:

- To print full blank square pattern using *

Example:

User Input: 3

Output:

* * *
*   *
* * *
fun main(args: Array<String>) {
  print("Enter number of rows : ") 
  val userInput = readLine()!!
  var rows:Int =userInput.toInt()
  for(i in 1..rows) {
    for(j in 1..rows) {
      if(i==1||i==rows||j==1||j==rows)print("* ")
      else print("  ")
    }
    println("")
  }
}

Output:

Enter number of rows: 6

* * * * * *
*         *
*         *
*         *
*         *
* * * * * *
Program
pattern

Main Logic :

for(i in 1..rows) {
  for(j in 1..rows) {
    if(i==1||i==rows||j==1||j==rows)print("* ")
    else print("  ")
  }
  println("")
}

You can print any thing in this pattern, just replace your value with *

Concept

Coming Soon !

Quick
Tutorial

Quote

A good decision is based on knowledge and not on numbers.