Print Number Pattern (1 to N)
C++
Easy
3 views
Problem Description
Print numbers instead of stars in pattern.
Real Life: Understanding value printing in patterns.
Step-by-Step Logic:
1. Similar to triangle pattern
2. But print numbers instead of stars
3. Print row number in each position
4. Shows how to print values in patterns
Official Solution
void pattern_q4_number_pattern() {
int n = 5;
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= i; j++) {
cout << i << " ";
}
cout << endl;
}
}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!