Triangle pattern in C++
Level 392 keystrokes
The inner loop runs up to the current row number i, so row 1 has one star, row 2 two stars, up to four stars in row 4.
C++ code
// One row for each i from 1 to 41for (int i = 1; i <= 4; i++) { // The limit is i, so each row is one star longer than the previous one2 for (int j = 1; j <= i; j++) { // Prints one star without a line break3 cout << "*";4 } // Ends the row after i stars5 cout << endl;6}Output
* ** *** ****
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this C++ code and how often they appear.
;× 6<× 6+× 4=× 4"× 2(× 2)× 2{× 2}× 2*× 1