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