#include<stdio.h> #include<conio.h> int main () { int first = 0, second = 1, third, i, n; printf ("Enter the length of the fibonacci series \n"); scanf ("%d", &n); printf ("The Fibonacci series is :\n"); printf ("%d%d", first, second); for (i = 2; i <= n; i++) { third = first + second; printf ("%d ", third); first = second; second = third; } return 0; }
OUTPUT:
Enter the length of the fibonacci series 10 The Fibonacci series is : 011 2 3 5 8 13 21 34 55