Tuesday, December 6, 2011

Write a C Program to create FIBBONACCI SERIES using RECURSION FUNCTION

#include <stdio.h>
#include <conio.h>
int y;
fib(int n)
 { if(n==1 || n==0)
    return n;
   y=fib(n-1)+fib(n-2);
    return y;
 }
int main()
 { int a,r;
   clrscr();
   printf("Enter any number : ");
   scanf("%d",&a);
   r=fib(a);
   printf("The no. at position %d is %d",a,r);
   getch();
   return 0;
 }

No comments:

Post a Comment