This program displays the Fibonacci series using recursion. Accept the end value of that series from user. This is a part of Mumbai University MCA Colleges C Program MCA Sem 1
#include<stdio.h>
#include<conio.h>
int f=1,s=1,t=0;
void main()
{
int n;
clrscr();
printf("Enter No.");
scanf("%d",&n);
printf("fibonacci series is:\n%d %d ",f,s);
fib(n);
getch();
}
int fib(int x)
{
t=f+s;
f=s;
s=t;
printf("%d ",t);
if(t<x)
fib(x);
else
getch();
}
Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.
Download
No comments:
Post a Comment