Jan 25, 2022

Printing Fibonacci series (C Language)

Simple printing series using while() loop.

 //Fibonacci series in C
#include<stdio.h>

//1  2  3  5  8  13 ...
//a  b  
//   a  b
int main()
{
    int a, b, c;
    a = 1;
    b = 2;
    while (a < 90)
    {
        printf("%d\n", a);
        c = b;
        b = a + b;
        a = c;
    }

    return 0;
}

No comments:

Post a Comment

Comparing two files in C language.

Operations on More than one File.    # include < stdio.h > # include < stdlib.h > # include < string.h > int main ( int ...