This program is to display the Fibonacci series. Accept the end value of that series from user. This is a part of Mumbai University MCA Colleges C Programs MCA Sem 1
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int n;
clrscr();
printf("Enter No.");
scanf("%d",&n);
fib(n);
getch();
}
int fib(int x)
{
int f=1,s=1,t=0;
printf("fibonacci series is:\n%d %d ",f,s);
while(t<x)
{
t=f+s;
f=s;
s=t;
printf("%d ",t);
}
}
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