fibonacci series c#
-
Saturday, February 12, 2011 12:23 PM
i need code for fibonacci series of numbers... but it should calculate for only five step... which means the output should be
0 1 1 2 3
tats it...
pls help me...
All Replies
-
Saturday, February 12, 2011 12:43 PM
int oldn=0;
int newno=1;
int fno;
int j=0;
for(; ;)
{fno=oldn+newno;
newno=fno;
oldn=newno;
j++;
if(j<4)
{
break;
}
Console.writeline(oldn,newno,fno);
}
easiest method made for you by me.
- Edited by techmania Saturday, February 12, 2011 12:46 PM some text missing
- Marked As Answer by Leo Liu - MSFTModerator Saturday, February 19, 2011 2:26 AM
-
Saturday, February 12, 2011 12:43 PM
Hi,
I have some problems to understand your problem. Can you please help a little more? My answer at the moment would be:
Console.Write("0 1 1 2 3");
which writes a list of the first 5 fibonacci numbers - as you requested.
Sorry, at the moment I have simply the feeling that this is a question like "Please do my homework". At least I will not write complete solutions in such cases. Target of a homework is, that you learn something. So please tell me, where you have a problem?
- Do you need information about the fibonacci series? http://en.wikipedia.org/wiki/Fibonacci_number
- Do you need to know how to write a program? Or you miss software? http://windowsclient.net could be a good start.
- Do you need information about methods or loops? Or maybe you want to learn about recursion?
Just tell us, what your problem really is and we will try to help you.
With kind regards,
Konrad
- Marked As Answer by Leo Liu - MSFTModerator Saturday, February 19, 2011 2:26 AM
-
Saturday, February 12, 2011 3:28 PMModerator
There is an example of Fibonacci at this link.
http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx
Rudy =8^D
Mark the best replies as answers. "Fooling computers since 1971."- Marked As Answer by Leo Liu - MSFTModerator Saturday, February 19, 2011 2:26 AM
-
Friday, June 03, 2011 5:36 AM
This is an example for printing Fibonacci numbers
http://www.programcall.com/6/interview/program-to-print-fibonacci-numbers-below-100.aspx

