/*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-
Previous Next
#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-
Previous Next
No comments:
Post a Comment