fork download
  1. #include <stdio.h>
  2.  
  3. int func(int n,int k){
  4. if(k==0||k==n){
  5. return 1;
  6. }else{
  7. return func(n-1,k-1)+func(n-1,k);
  8. }
  9. }
  10.  
  11. int main(void) {
  12. printf("%d\n",func(4,2));
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
6