Print Multiplication Table
C++
Medium
2 views
Problem Description
Print multiplication table of any number (like 5 × 1 = 5, 5 × 2 = 10...)
Real Life: Like the multiplication tables you learn in school.
Step-by-Step Logic:
1. Take number for which you want table
2. Use loop from 1 to 10
3. Multiply number with loop counter
4. Print each multiplication result
Official Solution
void control_q7_multiplication_table() {
int number = 7;
cout << "Multiplication table of " << number << ":" << endl;
for(int i = 1; i <= 10; i++) {
cout << number << " x " << i << " = " << number * i << endl;
}
}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!