Fibonacci Sequence of numbers

Fibonacci series is the sequence of numbers where each member is sum of previous two numbers. First two numbers of the series are 0 & 1. We will print first 10 numbers by using a for loop but same can be increased to any number of numbers.
#include <stdio.h>
int main(void){
int i;
int num1=0;
int num2=1;
int num3;

for ( i=1;i<=10;i++){
return 0;
Output is here
You can increase the loop by changing the upper limit of i to any value at the for loop.
After displaying the value of variable num3 we reassigned the numbers by making num1 value equal to num2 and num2 value equal to num3. Then the loop continues ...


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here

    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 All rights reserved worldwide Privacy Policy Disclaimer