AIM:A program to print the fibanocci series.
PROGRAM:
#include<stdio.h>
main()
{
int i,n,a=0,b=1,c;
printf("enter the value of n");
scanf("%d",&n);
while(i<=n)
{
c=a+b;
printf("%d",c);
a=b;
b=c;
}
printf("%d",c);
printf("the fibanocci series is%d\n");
}
OUTPUT:
enter the value of n
4
the fibanocci series is 0,1,2,3
No comments:
Post a Comment