"Coding is just like talking to a unknown girl. Once you talked to her with guts, the next time you'll never afraid",Really? Yes , try it Now !!!
Everything here is for education and learning purpose only , individual holds rights on outer posts/links etc.
Team Cracking The Code
About Me
▼
Wednesday, March 23, 2011
WAP to SUM the Fibonnaci Series
#include #include long int fib(long int); int main() { long int sum=0; long int k; int i,n; printf("\nEnter the number of element in the series : "); scanf("%d",&n); for(i=1;i<=n;i++) { k=fib(i); sum=sum+k; } printf("sum of %ld",sum); return (0); } long int fib(long int n) { if(n<=1) { return n; } else { return fib(n-1)+fib(n-2); } }
No comments:
Post a Comment
Hi thanks , we will get back to you shortly !!!