C Program to print fibonacci series

/*Series are 0 1 1 2 3 5 8 13 21...................*/

#include<stdio.h>
#include<conio.h>
main( )
{
int first=0,second=1,c=0,i;
clrscr( );
printf("\n\t%d",first);
printf("\n\t%d",second);
for (i=1; i<=10; i++)
{
c=first+second;
printf("\n\t%d",c);
first=second;
second=c;
}
getch( );
}

Output:
Run-

No comments:

Post a Comment

100 C Programs with Code and Output

Program 1: C Program To Read Two Numbers And Print The Sum Of Given Two Numbers. Program 2: C Program To Read Three Numbers And Prin...