← Coding round practice

Multiplication Table

EasyLoops

The problem

Print the multiplication table of a number from 1 to 10 using a loop.

Sample input

7

Sample output

7 x 1 = 7
7 x 2 = 14
7 x 3 = 21
7 x 4 = 28
7 x 5 = 35
7 x 6 = 42
7 x 7 = 49
7 x 8 = 56
7 x 9 = 63
7 x 10 = 70
Show the solution · 8 languages
fun main() {
    val n = 7
    for (i in 1..10) {
        println("$n x $i = ${n * i}")
    }
}