Testing.

Sunday, 22 January 2017

C programming language: C program to find first ten Fibonacci sequence/series.

For Example:- 0 1 1 2 3 5 8 13 21 34
----------------------
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,a,b,c;
    printf("\nEnter a number: ");
    scanf("%d",&n);
    i=1;
    a=0;
    b=1;
    while(i<=n)
    {
        printf(" %d  ",a);
        c = a + b;
        a = b;
        b = c;
        i++;
    }
getch();
}

No comments:

Post a Comment