PROGRAM TO PRINT FIBONACCI SERIES
#include <stdio.h>
int main() {
int i,n,a=0,b=1,c;
printf("Enter value of n");
scanf("%d",&n);
printf("%d\t",a);
for(i=3;i<=n;i++)
{
c=a+b;
a=b;
b=c;
printf("%d\t",c);
}
return 0;
}
OUTPUT:
Enter value of n
10
0 1 2 3 5 8 13 21 34
Comments
Post a Comment