Fabonacci series {using loops}
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,a=0,b=1,c;
printf("enter value of n= ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("%d,",a);
c=a+b;
a=b;
b=c;
}
getch();
}
Comments
Post a Comment