Write a C program to print a Fibonacci Series using Recursive function.
Answers
Answered by
0
Answer:
#include<stdio.h>
void printFibonacci(int n){
static int n1=0,n2=1,n3;
if(n>0){
n3 = n1 + n2;
n1 = n2;
n2 = n3;
printf("%d ",n3);
Explanation:
Answered by
0
Answer:
#include<stdio.h>
#include<conio.h>
void fib(int range)
{
int a = 0 , b = 1 , c;
printf("%d %d" , a , b);
for(int i = 2; i < range; i++)
{
c = a + b;
printf(" %d" , c);
a = b;
b = c;
}
}
int main()
{
printf("Enter the number of numbers in the fibonacci series:");
int ran;
scanf("%d" , &ran);
fib(ran);
getch();
}
Explanation:
Similar questions