C Introduction
Control Statement
- Program to Reverse a String
- Reverse a String by swapping
- Program to check largest number
- Program to find factor of a number
- Program to find largest number among n numbers
- Program to print multiplication table
- An effective way to use of Else If
- Program to check vowel or not
- Program to find factorial of number
Functions
Array
Pointers
Structure and Union
Data Files
Program to print the Fibonacci Series using Function
In this example, We will learn a program to print the Fibonacci Series using function. Before that, You must have knowledge of the following topics
Algorithm
This is the algorithm of program to find fibonacci Series
Step 1: Start
Step 2: Initialize variables i, n, t1 = 0, t2 = 1
Step 3: Initialize variable and assign t1 + t2
Step 4: Take input from the user and assign to variable n
Step 5: Assign i = 1
Step 6: Repeat this step until i <= n
Step 6.1: Print nextTerm variable
Step 6.2: t1 = t2
Step 6.3: t2 = nextTerm
Step 6.4: nextTerm = t1 + t2
Step 7: End
Flowchart
This is the flowchart of program to find fibonacci Series

CODE: Fibonacci Series using Function
We will print fibonacci Series
#include<stdio.h>
//Function Prototype
void fibonacci(int num);
void main(){
int num = 0;
printf("Enter number of terms : ");
scanf("%d", &num);
//Function to print Fibonacci Series
fibonacci(num);
}
//Function to print Fibonacci Series
void fibonacci(int num){
int a, b, c, i = 3;
a = 0;
b = 1;
if(num == 1)
printf("%d",a);
if(num >= 2)
printf("%d\t%d",a,b);
while(i <= num){
c = a+b;
printf("\t%d", c);
a = b;
b = c;
i++;
}
}
The output of above program is
Enter number of terms : 10
0 1 1 2 3 5 8 13 21 34