fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int n=5, i, j, space, num;
  5.  
  6. for(i = 0; i < n; i++) {
  7. // Print spaces
  8. for(space = 0; space < n - i - 1; space++)
  9. printf(" ");
  10.  
  11. num = 1;
  12. for(j = 0; j <= i; j++) {
  13. printf("%4d", num);
  14. num = num * (i - j) / (j + 1);
  15. }
  16. printf("\n");
  17. }
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 5316KB
stdin
stdout
           1
         1   1
       1   2   1
     1   3   3   1
   1   4   6   4   1