Saturday, August 20, 2011

Find nth term in fibnacci series

//Find nth term in fibnacci series
#include<stdio.h>
#include<conio.h>
main()
{
      int n;
      int fib(int n);
      printf("Enter the whichth number you want to see in fibnacci series :");
      scanf("%d",&n);
      printf("\n the term is %d",fib(n));
      getch();
      return 0;
}
int fib(int n)
{
    if(n==0||n==1)
    return n;

return (fib(n-1)+fib(n-2));  
}

Previous Next Home
0 Comments
Comments

Leave a Comment

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

Twitter Delicious Facebook Favorites More