/*write a c program to n terms of the folllowing series 1,1,2,3,5,8,13.....*/ #include<stdio.h> #include<conio.h> void main() { int n,i,a=1,b=1,c=0; clrscr(); printf("enter value of n:"); scanf("%d",&n); printf("\nthe fibonacci series "); for(i=1;i<=n;i++) { a=b; b=c; c=a; c=a+b; printf("%d",c); if(i<n) printf(","); else printf(""); } getch(); }
No comments:
Post a Comment