fork download
  1. #include <stdio.h>
  2.  
  3. int fibo(int n){
  4. if(n==1|| n==2) return 1;
  5. else return fibo(n-1)+fibo(n-2);
  6.  
  7. }
  8.  
  9. int main() {
  10. int n;
  11. printf("Enter the value of n: \n");
  12. scanf("%d",&n);
  13. int f= fibo (n);
  14. printf("%d",f);
  15. return 0;
  16. }
Success #stdin #stdout 0s 5288KB
stdin
3
stdout
Enter the value of n: 
2