. * /* FIBONACII SERIES */ #include<stdio.h> #include<conio.h> void main() { inta,b,c,n; clrscr(); printf("enter the value of n"); scanf("%d",&n); a=0; b=1; printf("fibonacci series is\n%d\n%d\n",a,b); while(1) { c=a+b; if(c<=n) { printf("%d\n",c); } else { break; } a=b; b=c; } getch(); } /*****output******* enter the value of n9 fibonacci series is 0 1 1 2 3 5 8 *************/
Comments
Post a Comment