#include<stdio.h> void fibonacci(int); main() { int k,n; long int i=0,j=1,f; printf("Enter the range of the Fibonacci series: "); scanf("%d",&n); printf("Fibonacci Series: "); printf("%d %d ",0,1); fibonacci(n); } void fibonacci(int n) { static long int first=0,second=1,sum; if(n>0) { sum = first + second; first = second; second = sum; printf("%ld ",sum); fibonacci(n-1); } }
New Android apps UniqueKey
Friday, 20 February 2015
Fibonacci series recursive
Labels:
C language
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment