Display Fibonacci series in C Program

1 min read
Share this
Table Of Content

In this tutorial, learn to display the Fibonacci sequence of first n numbers (entered by the user) in c programming language. Fibonacci Series in C using loop

Copy
#include<stdio.h>
int main()
{
    int count, start = 0, second = 1, next, i;

    //Ask user to input number of terms
    printf("Enter a positive number:\n");
    scanf("%d",&count);

    printf("First %d terms of Fibonacci series:\n",count);
    for ( i = 0 ; i < count ; i++ )
    {
       if ( i <= 1 )
          next = i;
       else
       {
          next = start + second;
          start = second;
          second = next;
       }
       printf("%d\n",next);
    }
    return 0;
}

Output

Copy
Enter a positive number:
8
First 8 terms of Fibonacci series:
0
1
1
2
3
5
8
13
0 Comments
Related Tutorials
Essential Git Skills: How to Delete Remote Branches

Essential Git Skills: How to Delete Remote Branches

Managing branches is a crucial part of working with Git, especially when it comes to keeping your repository clean and organized. In this guide, we'll walk you through how to delete both local and remote branches in Git.

BITBUCKETDELETE LOCAL BRANCHDELETE REMOTE BRANCHGITGIT BRANCH CLEANUP AUTOMATION

June 12, 2024

How to Show Automatic Internet Connection Offline Message in Flutter

How to Show Automatic Internet Connection Offline Message in Flutter

You have to use the 'Connectivity Flutter Package' to achieve this feature on your App. This package helps to know whether your device is online or offline.

CONNECTIVITY PLUSDEPENDENCIESFLUTTERFLUTTER DEVELOPMENTFLUTTER PACKAGES

April 09, 2024

Mastering TabBar and TabBarView Implementation in Flutter: A Comprehensive Guide for 2023

Mastering TabBar and TabBarView Implementation in Flutter: A Comprehensive Guide for 2023

Discover the art of implementing TabBar and TabBarView widgets in Flutter with our comprehensive guide for 2023. Learn step by step how to create captivating user interfaces, customize tab indicators, enable scrollable tabs, change tabs programmatically, and more. Elevate your Flutter app's navigation and user experience with expert insights and practical examples.

CODINGDEFAULT TAB CONTROLLERFLUTTERLEARN TO CODETAB CONTROLLER

July 26, 2023

Enhancing File Manipulation in Flutter: Best Practices and Examples

Enhancing File Manipulation in Flutter: Best Practices and Examples

Master Flutter file manipulation like a pro. Our comprehensive blog provides insights on permission management, directory handling, and practical read-write scenarios. Elevate your app's file management.

CODINGFLUTTERFLUTTER DEVELOPMENTFLUTTER FILE OPERATIONFLUTTER PATH PROVIDER

June 30, 2023

Related Recommended Videos

Yubikey - The Ultimate Beginner Guide (How to Setup & Use)

The YubiKey is a hardware authentication device manufactured by Yubico to protect access to computers, networks, and online services that supports one-time passwords, public-key cryptography, and authentication, and the Universal 2nd Factor and FIDO2 protocols developed by the FIDO Alliance.

AUTHENTICATIONCRYPTOGRAPHYHARDWARESECURITYYOUTUBE

Master Flutter in Just 8 Hours | Full Course Hindi

Learn Flutter from basics to advanced in just 8+ hours. This covers everything related to UI, Data, Model, API, State Management, Navigator 2.0 and more.

ANDROIDANIMATED CONTAINERAPP BAR THEMEBUILD CONTEXTCARD

Flutter Master Class Travel App | Flutter 3.13.0 for Beginners to Advanced | iOS & Android Cubit

From this tutorial we build a flutter cubit / bloc state management app. We will build it step by step. We will also build the ui and do api request. We will cover http get request and load the data using flutter cubit or bloc. We will also see how to use bloc-provider and bloc-builder for state update. This covers building the model and API request. (not speed code, not the flutter way). So this is a travel app. It's also very beginners friendly app.

ANDROIDBLOCBLOC BUILDERBLOC CONSUMERBLOC LISTENER

Docker Tutorial for Beginners

Docker Tutorial for Beginners - Learn Docker for a career in software or DevOps engineering. This Docker tutorial teaches you everything you need to get started.

BEGINNERSDEV OPSDEVELOPMENTDOCKERPROGRAMMING LANGUAGE