/*****************<soeasyprograms.blogspot.in>******************/
/*program to print n terms of fibonacci series*/
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,sum,a=0,b=1;
clrscr();
printf("enter the number of terms in fibonacci series\n");
scanf("%d",&n);
printf("First %d terms of fibonacci series are:\n",n);
printf(" %d ",a);
printf(" %d ",b);
for(i=1;i<=n-2;i++)
{
sum=a+b;
a=b;
b=sum;
printf(" %d ",sum);
}
getch();
}
i wan this program in c++
ReplyDelete