C program to print Fibonacci series
Fibonacci series is a series in which numbers are in following sequences:
1, 2, 3, 5, 8, 13, 21, …
if we want to add new number in this series then we have to add last to numbers in the series.
e.g. in above series next number will be 21+13 = 34
Fn = Fn-1 + Fn-2
Following is the C Program to generate Fibonacci series.
Logic to print Fibonacci series in C
#include <stdio.h>
int main()
{
int num1, num2, i, l, temp;
printf("Enter first number : ");
scanf("%d", &num1);
printf("Enter second number : ");
scanf("%d", &num2);
printf("Enter the count of number you want to generate : ");
scanf("%d", &l);
printf("Fibonacci Series : ");
for (i=1; i<=l; ++i)
{
printf("%d, ", num1);
temp = num1 + num2;
num1 = num2;
num2 = temp;
}
return 0;
}
Output :
Enter first number : 1
Enter second number : 2
Enter the count of number you want to generate : 5
Fibonacci Series : 1, 2, 3, 5, 8,
PRACTICALS/PRACTICE PROGRAM IN C
CHECKOUT OTHER RELATED TOPICS
CHECKOUT OTHER QUIZZES
Quizzes on Operator |
Easy Quiz on Operators in C part 1 |
Easy quiz on operators in C part 2 |
Easy quiz on operators in C part 3 |
Quizzes on Loops |
Easy quiz on loops in C part 1 |
Easy quiz on loops in C part 2 |
Easy quiz on loops in C part 3 |
Quizzes on Decision Making Statement |
Easy Quiz On Decision Making Statements Part 1 |
Easy Quiz On Decision Making Statements Part 2 |
Quizzes on String |
Easy quiz on String in C programming part 1 |
Quizzes on Array |
Easy quiz on Array in C programming – part 1 |
5 – Best Java program to convert decimal to binary |
New Quizzes Coming soon.. |
We are aiming to explain all concepts of C in easiest terms as possible.

ITVoyagers
Author