Youtube RSS Feed
Learn with Vikas Suhag
Program to implement Fibonacci series using C Language
Jan 04, 2022   Vikas Suhag
Fibonacci series using C Language

Program to implement Fibonacci series using C Language

Fibonacci series involves addition of last two numbers to generate next number. It can be achieved using one dimensional array and loops.

#include <stdio.h>
int main()
{
int i, fibonacci[20]; // declaration of array (0-19)
fibonacci[0] = 0; // initialization of array // value assign
fibonacci[1] = 1; // initialization of array // value assign
for( i = 2; i < 20; i++ ) //4
    fibonacci[i] = fibonacci[i - 2] + fibonacci[i - 1];
for( i = 0; i < 20; i++ )
    printf( "Fibonacci[%d] = %d\n", i, fibonacci[i]);
}


Leave a Comment

* Email will not be published.
All comments are only visible after approval.
Most Viewed articles
Search
Subscribe to Email Updates
Vikas Suhag

I am Engineer, Developer, Teacher, Blogger, Vlogger, Traveller, Photographer...

I have been developing websites, writing blogs and recording videos during my travel while being a full tim ...

Youtube Channel
Podcast
Subscribe to Email Updates
Connect With Us
Youtube RSS Feed
© 2022 Learn with Vikas Suhag. All Rights Reserved.