Write a program in C to print Fibonacci Series
#include <stdio.h>
#include <conio.h>
void main()
{
int n, i, temp, first=0, second=1;
clrscr();
printf("Enter the range of Fabonacci Series : ");
scanf("%d",&n);
for(i=1; i<=n; i++) {
printf("%d ", first);
temp=first;
first=second;
second=second+temp;
}
getch();
}
#include <conio.h>
void main()
{
int n, i, temp, first=0, second=1;
clrscr();
printf("Enter the range of Fabonacci Series : ");
scanf("%d",&n);
for(i=1; i<=n; i++) {
printf("%d ", first);
temp=first;
first=second;
second=second+temp;
}
getch();
}
Post a Comment