Monday, August 1, 2016

Fibonacci Series in C Programming using Do While Loop

/* 3 3 6 9 15 fibonacci series upto 10th term */
#include<stdio.h>
#include<conio.h>
void main()
{
    int a=3,b=3,c,i;
    printf("\n %d",a);
    printf(" %d ",b);
    i=1;
    do
    {
        c=a+b;
        printf("%d ",c);
        a=b;
        b=c;
        i++;
    }
    while (i<=10);
    getch();
}

0 comments:

Post a Comment