fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int n = 5;
  5. for (int i = 0; i < n; i++) {
  6. /* Step 1: Increasing leading spaces */
  7. for (int s = 0; s < i; s++) {
  8. printf(" ");
  9. }
  10. /* Step 2: Decreasing asterisks */
  11. for (int j = 0; j < n- i; j++) {
  12. printf("*");
  13. }
  14. printf("\n");
  15. }
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 5332KB
stdin
Standard input is empty
stdout
*****
 ****
  ***
   **
    *