Print Right Triangle Pattern
C++
Easy
2 views
Problem Description
Print stars in increasing pattern (right triangle).
Real Life: Understanding row-dependent printing.
Step-by-Step Logic:
1. Row 1: print 1 star
2. Row 2: print 2 stars
3. Row n: print n stars
4. Stars in each row = row number
Official Solution
void pattern_q2_right_triangle() {
int n = 5;
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= i; j++) {
cout << "* ";
}
cout << endl;
}
}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!