fork download
  1. #include <stdio.h>
  2. int tri(int n){
  3. if(n==0)
  4. return 0;
  5. else if(n==1)
  6. return 0;
  7. else if(n==2)
  8. return 1;
  9. else
  10. return tri(n-1)+tri(n-2)+tri(n-3);
  11. }
  12. int main(void) {
  13. // your code goes here
  14. int n=7;
  15. printf("%d",tri(n));
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
13