fork download
  1. #include <stdio.h>
  2.  
  3. int comb(int n,int r){
  4. if(r==0||r==n)
  5. return 1;
  6. else
  7. return comb(n-1,r-1)+comb(n-1,r);
  8. }
  9. int main(void) {
  10. int a=6;
  11.  
  12. for (int i=0;i<=a;i++){
  13. for (int k=0;k<a-i;k++)
  14. printf(" ");
  15. for(int j=0;j<=i;j++){
  16. printf("%d",comb(i,j));
  17. }
  18. printf("\n");
  19. }
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0.01s 5316KB
stdin
Standard input is empty
stdout
      1
     11
    121
   1331
  14641
 15101051
1615201561