Multiplication Table Generator - Problem

Generate and display the multiplication table for a given number from 1 to 12 in a formatted grid layout.

The table should show each multiplication result in the format: number × i = result where i ranges from 1 to 12.

Each row should be displayed on a separate line with consistent formatting.

Input & Output

Example 1 — Basic Case
$ Input: number = 7
Output: 7 × 1 = 7 7 × 2 = 14 7 × 3 = 21 7 × 4 = 28 7 × 5 = 35 7 × 6 = 42 7 × 7 = 49 7 × 8 = 56 7 × 9 = 63 7 × 10 = 70 7 × 11 = 77 7 × 12 = 84
💡 Note: Generate multiplication table for 7: each row shows 7 multiplied by numbers 1 through 12
Example 2 — Single Digit
$ Input: number = 3
Output: 3 × 1 = 3 3 × 2 = 6 3 × 3 = 9 3 × 4 = 12 3 × 5 = 15 3 × 6 = 18 3 × 7 = 21 3 × 8 = 24 3 × 9 = 27 3 × 10 = 30 3 × 11 = 33 3 × 12 = 36
💡 Note: Multiplication table for 3 showing all results from 3×1 to 3×12
Example 3 — Edge Case with 1
$ Input: number = 1
Output: 1 × 1 = 1 1 × 2 = 2 1 × 3 = 3 1 × 4 = 4 1 × 5 = 5 1 × 6 = 6 1 × 7 = 7 1 × 8 = 8 1 × 9 = 9 1 × 10 = 10 1 × 11 = 11 1 × 12 = 12
💡 Note: Special case where multiplying by 1 gives the sequence 1 through 12

Constraints

  • 0 ≤ number ≤ 100
  • Output must include all 12 rows
  • Each row format: 'number × i = result'

Visualization

Tap to expand
INPUTALGORITHMRESULT7Number to generate table for1Start loop: i = 12Calculate: 7 × i3Format output string4Repeat until i = 12Complete Table7 × 1 = 77 × 2 = 147 × 3 = 217 × 4 = 28...7 × 11 = 777 × 12 = 84Key Insight:A simple for loop from 1 to 12 generates the complete multiplication tableby multiplying the input number with each counter value.TutorialsPoint - Multiplication Table Generator | Simple Loop
Asked in
Educational Platforms 25 Coding Bootcamps 20
12.0K Views
High Frequency
~5 min Avg. Time
450 Likes
Ln 1, Col 1
Smart Actions
💡 Explanation
AI Ready
💡 Suggestion Tab to accept Esc to dismiss
// Output will appear here after running code
Code Editor Closed
Click the red button to reopen