Breaking

Friday, 30 November 2018

Write a Program 0,1,1,2,3,5,8,13….N tearms(Fibonacci Series) | C Programing | Android Solution


Write a Program 0,1,1,2,3,5,8,13….N tearms(Fibonacci Series)



#include<stdio.h>
#include<conio.h>
void main()
{
                int i,n,n1,n2,n3;
                clrscr();

                printf("\n enter number");
                                scanf("%d",&n);
                n1=0;
                n2=1;

                printf("%d\t%d ",n1,n2);

                for(i=1;i<=n-2;i++)
                {
                                n3=n1+n2;
                                printf("\t%d",n3);
                                n1=n2;
                                n2=n3;

                }
                getch();
}


OutPut :-



No comments:

Post a Comment