Program to generete fibonacci series
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int a = -1, b = 1, c = 0, i, n;
clrscr();
printf("Enter the limit : ");
scanf("%d", &n);
printf("\nThe fibonacci series is : \n\n");
for(i = 1 ; i <= n ; i++)
{
c = a + b;
printf("%d \t", c);
a = b;
b = c;
}
getch();
}
Output:
Enter the limit : 7
The fibonacci series is :
0 1 1 2 3 5 8
-
UpdatedDec 31, 2019
-
Views6,424
You May Like
Program to maintain employee details using structures
Program to maintain student details using structures
Check whether the person is eligible to vote or not
Print the numbers that are divisible by a given no.
Program to generate magic square
To sort the given numbers in ascending & descending order