#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; }
Output:
Enter the term: 10 The fibonacci series is: 0 1 1 2 3 5 8 13 21 34