In this program, you will learn how to display Fibonacci Series upto the user provided terms using function. The Fibonacci Sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34. Here the next number is the sum
#include<stdio.h>
#include<conio.h>
void findfib()
{
int term, i;
int first=0, second=1, next;
clrscr();
printf("Enter the term: ");
scanf("%d", &term);
for(i=2; i<term; i++)
{
next = first + second;
printf(" %d", next);
first = second;
second = next;
}
}
void main() {
findfib();
getch();
}
Enter the number: 4
Factorial = 24