C and C++

Write a program to print Fibonacci Series upto a given number of terms

The Fibonacci series is a sequence of integers in which the first two integers are 1 and from
third integer onwards each integer is the sum of the previous two integers of the sequence i.e.
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, …………………………..
The program which implements the above logic is as follows:

#include<stdio.h>
int Fibonacci(int);
void main()
{
int term,i;
printf(“Enter the number of terms of Fibonacci Series which is going to be printed”);
scanf(“%d”,&term);
for(i=0;i<term;i++)
{
printf(“%d”,Fibonacci(i));
}
}
int Fibonacci(int x)
{
if(x==0 || x==1)
return 1;
else
return (Fibonacci(x-1) + Fibonacci(x-2));
}
Output:
Enter the number of terms of the Fibonacci Series which is going to be printed 6
1 1 2 3 5 8 13