write a program to generate Fibonacci series upto 10 terms in array and display the series
Answers
Answered by
2
Answer:
Explanation:
#include<stdio.h>
int main()
{
int i,range;
long int arr[40];
printf(“\nEnter the number range: “);
scanf(“%d”,&range);
arr[0]=0;
arr[1]=1;
for(i=2;i<range;i++)
{
arr[i] = arr[i-1] + arr[i-2];
}
printf(“Fibonacci series is: “);
for(i=0;i<range;i++)
printf(“%ld “,arr[i]);
printf(“\nFibonacci Ends \n\n”);
return 0;
}
Similar questions