Friday, 21 July 2017

Write a program that printout FIBONACCI SERIES ( 1, 1, 2, 3, 5, 8, 13.....)

Write a program that printout FIBONACCI SERIES ( 1, 1, 2, 3, 5, 8, 13.....).

Fibonacci Series is in the form of zero, 1, 1, 2, three, five, 8, thirteen, 21,...... To find Fibonacci series we add  previous terms/digits and get next term/variety.


What is Fibonacci series?

The Fibonacci series is a sequence of numbers where more than a few is discovered with the aid of including up the two numbers before it. Starting with zero and 1, the series is going 0, 1, 1, 2, 3, 5, eight, 13, 21, 34, and so forth. Written commonly, the expression is xn = xn-1 + xn-2.

Code:

#include<stdio.h>
#include<conio.h>
void main()
{
 int a,n;
 int i=1,j=1,k;
 printf("Enter The Range ");
 scanf("%d",&n);
 printf("Fibonacci Series ");
 printf("%d %d",i,j);
 for(a=3;a<=n;a++)
 {
 k=i+j;
 i=j;
 j=k;
 printf(" %d",k);
 }
 getch();
 clrscr();
}

Output:



Try it yourself.
If you have any problem you can tell me on comment box i will help you.
thanks.

Viral Programs

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.

0 comments:

Post a Comment