C Program to Display Fibonacci Series in a Given Range

The Fibonacci series is a series of numbers where each number is the sum of the two preceding ones, usually starting with 0 and 1. Here’s a simple C program to display the Fibonacci series up to a specified number of terms

Program :

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,i,n;
a=0;
b=1;
printf(“\nEnter n for how many times generate series : “);
scanf(“%d”,&n);
printf(“\nFibonacci Series : \n”);
printf(“%d %d “,a,b);
for(i=0;i<=n-3;i++)
{
c=a+b;
a=b;
b=c;
printf(“%d “,c);
}
getch();
}

Output :

Leave a Comment

Your email address will not be published.

Shopping Basket
Verified by MonsterInsights