Fibonacci series in C || do while loop || C Programming

In this, we are going to see the do-while loop, the program is based on the do-while loop which basically Prints Fibonacci series with the help of the C Programming language.



#include <stdio.h>
int main()
{
    int n;
    int a = 0;
    int b = 1;
    int c;
    int fib = 0;
    printf("How many fibonacci numbers do you want to print ?, enter value for n: ");
    scanf("%d",&n);
    printf("0 1 ");
    do
    {
        c = a + b;
        printf("%d ", c);
        a = b;
        b = c;
        n--;
    } while (n > 2);
    return 0;
}

//..........Coded by ARADHANA MISHRA


#ENJOY CODING

Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post