Click here to Skip to main content
15,912,578 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Im relatively new to coding, and one of my tasks is create a fibonacci code in C#. the user inputs two numbers and the output is displayed. the sequence can only be less than or equal to 200.

Thanks in advance!
Posted
Comments
stibee 4-May-13 4:51am    
Did you check other post in codeprojekt like:
http://www.codeproject.com/Questions/118727/fibonacci-code-in-c ?

Or first match on google?
http://www.dotnetperls.com/fibonacci

1 solution

First write it out in normal type language, and convert the result to C#. Something like:
Let number1 = 0
Let number2 = 1
Print "0"
Print "1"
Let limit = << input from user
While limit > 0
Do
    Let sum = number1 + number2
    Print sum
    Let number1 = number2
    Let number2 = sum
    Let limit = limit - 1
Done
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900