A Platform to LEARN | CODE | ACHIEVE

Connect :

#### TO GENERATE A FIBONACCI SERIES UPTO N ELEMENTS IN C

Code

```#include<stdio.h>
int main()
{
int n;
int first=0,second=1;
int third,i;
printf("FIBONACCI SERIES \n");
printf("UPTO WHICH ELEMENT ? \n");
scanf("%d",&n);
printf("%d %d ",first,second);
for(i=1;i<=n-2;i++) // because we already printed first two digits of a fibonacci series
{
third=first+second;
printf("%d ",third);
first=second;
second=third;
}
return 0;
}
```

Output

FIBONACCI SERIES
UPTO WHICH ELEMENT ? 10
0 1 1 2 3 5 8 13 21 34

What we did - Our Approach

In this problem we have to find the fibonacci series upto 'N' elements.The Fibonacci series represents the numbers in the following integer sequence, called the Fibonacci sequence, and characterized by the fact that every number after the first two is the sum of the two preceding ones. Ex : 0,1,1,2,3,5,8,13,21,34,55,89,144....

See this code in :

C++

Java

Participate in our MONTHLY CHALLENGE,and get a chance to get listed on our site and win the TITLE of "MR.GEEK".

RUSH TO OUR MONTHLY CHALLENGE

#### A Platform to LEARN | CODE | ACHIEVE

Connect :

SHARE:

For any Queries,suggestions,feel free to Mail us at :
codeofgeeks@gmail.com

For reporting any kind of copyright voilation,mail us at : cogcopyclaim@gmail.com 