Kotlin Program:

- To print the multiplication table of a number

Example:

User Input : 3

Output:

3 x 1 = 3
3 x 2 = 6
3 x 3 = 9
3 x 4 = 12
3 x 5 = 15
3 x 6 = 18
3 X 7 = 21
3 x 8 = 24
3 x 9 = 27
3 x 10 = 30
import java.util.Scanner
fun main(args: Array<String>) {
  
  print("Enter your number :")
  val userInput = Scanner(System.`in`)
  var num:Int = userInput.nextInt()

  println("Multiplication table of $num")
  for(i in 1..10)
    println("$num X $i = ${num*i}")
}

Output:

Enter your number : 5
Multiplication table of 5
5 x 1 = 5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 X 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50
Program
basic

Here we just multiply the number by 1 to 10 and print it on the output screen

for(i in 1..10)
  println("$num X $i = ${num*i}")

If you want more than 10 multiplication values, just increase the value from 10 inside for loop

Concept

Coming Soon !

Quick
Tutorial

Quote

Make bold choices and make mistakes. It’s all those things that add up to the person you become.