Posts

Showing posts with the label C program to print the Fibonacci series.

C program to print the Fibonacci series.

Image
  C PROGRAM C program to print the  Fibonacci series #include<stdio.h> #include<conio.h> void main()  {     int n,first=0,second=1,next,a;     clrscr();     printf("enter the number of terms");     scanf("%d",&n);     for(a=0;a<n;a++)     {     if(a<=1)     {       next=a;       printf ("%d",next);       }       else       {       first=second;       second=next;       next=first+second;       printf("%d",first);       }       }       getch();       } OUTPUT :  enter the number of terms10 011123581321 Process finished.