Star Triangle in C
Level 392 keystrokes
Uses nested loops to print a right-angled triangle of stars.
C code
// One pass per row; i is also the number of stars in that row1for (int i = 1; i <= 4; i++) { // The inner limit depends on i, so each row gets one more star2 for (int j = 1; j <= i; j++) { // Print one star without a newline3 printf("*");4 } // Finish the row; the rows are *, **, ***, ****5 printf("\n");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"× 4(× 4)× 4+× 4=× 4{× 2}× 2<× 2*× 1