Write a to display fibonacii series using C program with functions- computer 11 - Neb- c program
Write a to display Fibonacci series using C program with functions.
Solutions:
#include<stdio.h>
void fibonacciSeries(int range)
{
int a=0, b=1, c;
while (a<=range)
{
printf("%d\t", a);
c = a+b;
a = b;
b = c;
}
}
int main()
{
int range;
printf("Enter range: ");
scanf("%d", &range);
printf("The fibonacci series is: \n");
fibonacciSeries(range);
return 0;
}
0 Comments