WRITE A PROGRAM TO PRINT FIBONACCI SERIES - Computer Programming

Latest

C C++ Java Python Perl Programs Examples with Output -useful for Schools & College Students

Sunday, October 30, 2011

WRITE A PROGRAM TO PRINT FIBONACCI SERIES


WRITE A PROGRAM TO PRINT FIBONACCI SERIES

#include<stdio.h>
#include<conio.h>
void main()
{
int f,s,n,c,t;
clrscr();
printf(“Enter the number of series \n”);
scanf(“%d”,&n);
f=1;
s=1;
printf(“%d\t”,f);
printf(“%d\t”,s);
for(c=1;c<=n-2;c++)
{
t=f+s;
printf(“%d\t”,t);
f=s;
s=t;
}
getch();
}

No comments:

Post a Comment