// The fibonacci series.
#include<stdio.h>
#include<conio.h>
main()
{
int i,n,f,s,t;
printf("How many element you want to print:");
scanf("%d",&n);
f=0;
s=1;
printf("The fibonacci series up to %d is : %d,%d",n,f,s);
for(i=0;i<n-2;i++)
{
t=f+s;
f=s;
s=t;
printf(",%d",t);
}
getch();
}
#include<stdio.h>
#include<conio.h>
main()
{
int i,n,f,s,t;
printf("How many element you want to print:");
scanf("%d",&n);
f=0;
s=1;
printf("The fibonacci series up to %d is : %d,%d",n,f,s);
for(i=0;i<n-2;i++)
{
t=f+s;
f=s;
s=t;
printf(",%d",t);
}
getch();
}
No comments:
Post a Comment