Print the Table of Given Number

fun main() {
    println("Enter an Integer Number")//1
    val number = readLine()?.toInt()!!//2
    for(i in 1..10)//3
    {
        println("$number*$i=${number*i}")//4
    }
}
  1. Instruct the user to Enter an Integer Number
  2. Convert Number into int and assign to number variable
  3. Execute the for loop statement from 1 to 10
  4. Print the output on the console

Output

Enter an Integer Number
10
10*1=10 10*2=20
10*3=30 10*4=40 10*5=50 10*6=60
10*7=70 10*8=80
10*9=90 10*10=100


Leave a Reply

Your email address will not be published. Required fields are marked *