Friday, July 31, 2009

Fibonacci series using turbo-c?

This is compelete source for this program, which get number and show calculated numbers up to the entered number





#include%26lt;stdio.h%26gt;


#include%26lt;conio.h%26gt;


main()


{


int m=0,n,s=1,t=0;


clrscr();


printf("\nPlease Enter Number:");


scanf("%d",%26amp;n);


n-=1;


printf("\n1");


for (m;m%26lt;=n;m+=0)


{


m+=1;


if (m%26lt;=n)


{


t+=s;


printf("%5d",t);


}


m+=1;


if (m%26lt;=n)


{


s+=t;


printf("%5d",s);


}


}


getch();


return 0;


}


No comments:

Post a Comment