fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main()
  6. {
  7. unsigned int rows, i;
  8.  
  9. printf("Enter the number of rows\n");
  10. if (scanf("%u",&rows) == 1 && rows > 0)
  11. {
  12. char row[rows];
  13. memset(row, '*', rows);
  14.  
  15. for (i=rows; i--; )
  16. printf("%*.*s\n", rows, rows-i, row);
  17. };
  18.  
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 2056KB
stdin
10
stdout
Enter the number of rows
         *
        **
       ***
      ****
     *****
    ******
   *******
  ********
 *********
**********