
Problem
Solution
Submissions
Generate a Multiplication Table for a Given Number
Certification: Basic Level
Accuracy: 48.06%
Submissions: 129
Points: 5
Write a Python program that generates a multiplication table for a given number up to a specified range.
Example 1
- Input: number = 5, range = 10
- Output:
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 - Explanation:
- Step 1: Take number = 5 and range = 10 as input.
- Step 2: Generate multiplication table for 5 from 1 to 10.
- Step 3: Print each product in the format "5 x i = result".
Example 2
- Input: number = 12, range = 5
- Output:
12 x 1 = 12
12 x 2 = 24
12 x 3 = 36
12 x 4 = 48
12 x 5 = 60 - Explanation:
- Step 1: Take number = 12 and range = 5 as input.
- Step 2: Generate multiplication table for 12 from 1 to 5.
- Step 3: Print each product in the format "12 x i = result".
Constraints
- 1 ≤ number ≤ 10^6
- 1 ≤ range ≤ 1000
- Time Complexity: O(range)
- Space Complexity: O(1)
Editorial
My Submissions
All Solutions
Lang | Status | Date | Code |
---|---|---|---|
You do not have any submissions for this problem. |
User | Lang | Status | Date | Code |
---|---|---|---|---|
No submissions found. |
Solution Hints
- Use a for loop to iterate from 1 to the given range
- For each iteration i, calculate number * i
- Format and print each line as "number x i = result"