fork download
  1. #include <stdio.h>
  2. int fib3(int n) {
  3. if(n==0) return 0;
  4. else if(n==1) return 1;
  5. else return fib3(n-1) + (n-2);
  6.  
  7. }
  8.  
  9.  
  10. int main(void) {
  11. int n;
  12. scanf("%d",&n);
  13. printf("%d",fib3(n));
  14. return 0;
  15.  
  16. }
  17.  
Success #stdin #stdout 0.01s 5284KB
stdin
3
stdout
2