CCCCCCCCCCCCCCCCC

Tuesday, 24 December 2019

C program to dispay Fibonacci series to nth term.

#include<stdio.h>
#include<conio.h>
void main()
{
    int i, a=0, b=1, c=1,n;
    printf("\n enter the number of terms to be displayed:");
    scanf("%d",&n);
    for (i=0;i<n;i++)
    {
        printf("%d\t",c);
        c=a+b;
        a=b;
        b=c;
    }
    getch();
}

No comments:

Post a Comment