easyUnit 5 · Loops: for, while, break, continue
P13. Multiplication Table
Loops: for, while, break, continue
Read a number n and print its multiplication table from 1 to 10 using a for loop with range().
Input Format
- Line 1:
n
Output Format
- 10 lines, each in the form
n x i = product
Constraints
- -100 ≤
n≤ 100
Sample Test Cases
Sample 1
Input
7
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
Sample 2
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
Submitting checks 2 sample cases and 3 hidden test cases.