Introduction
- In this article, I'm going to explain how to write the Fibonacci series.
Software Requirements
- Turbo C++ OR C
Programming
- #include<stdio.h>
- void main()
- {
- int a,b,c,i,n;
- a=0;
- b=1;
- printf("Enter a no to define length of the series:");
- scanf("%d",&n);
- printf("\n The series is:\n");
- printf("%d\t%d",a,b);
- for (i=0;i<n;i++)
- {
- c=a+b;
- a=b;
- b=c;
- printf("\t%d",c);
- }
- getch();
- }
- In the above program, I have explained the logic of the Fibonacci series. The user can enter the length of the Fibonacci sequence and it will print on the output screen in a clear manner.

Output



Vignesh ManiPosted Jul 9, 2016, 5:43 PM
Good one