bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

external_8.c (421B)


      1 // 8. Write a program to print a triangle of stars (take number of lines from user).
      2 
      3 #include <stdio.h>
      4 
      5 int main() {
      6     int rows, i, j, k;
      7 
      8     printf("Enter the number of lines: ");
      9     scanf("%d", &rows);
     10 
     11     for (i = 1; i <= rows; i++) {
     12     	for(j = 1; j <= rows - i; j++) {
     13     		printf(" ");
     14 		}
     15         for (k = 1; k <= i; k++) {
     16             printf("* ");
     17         }
     18         printf("\n");
     19     }
     20     return 0;
     21 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror