Question: C# I need assistance completing this program. Thank you very much. Fibonacci numbers are well known sequence whereby the next number of the sequence is

C#

I need assistance completing this program. Thank you very much.

C# I need assistance completing this program. Thank you very much. Fibonaccinumbers are well known sequence whereby the next number of the sequence

Fibonacci numbers are well known sequence whereby the next number of the sequence is generated by adding the previous two. Let's seed the sequence with 0 and 1. From there we can get the next number by adding the previous two: 0112358132134(seed)(seed)(0+1=1)(1+1=2)(1+2=3)(2+3=5)(3+5=8)(5+8=13)(8+13=21)(13+21=34) After the first 10-15 numbers in the sequence, Fibonacci numbers grow very quickly in size. The 25th number will be upwards of 121K. The Golden Ratio (or Golden Mean) Especially as Fibonacci numbers get larger, when you divide the last number by the second to the last number, the quotient trends toward 1.618, which is known as the "golden ratio". For example, in the sequence of ten numbers above, 3421=1.619 not quite the golden ratio of 1.618, but already honing in on that value. The golden ratio is pervasive in nature, including fractals, flowers and plants, and your own body. Your Task: Write a C\# console program that will use a loop (any style - I like the 'for' loop) to generate the first 25 Fibonacci numbers (this does not include the initial 0 and 1 , which are used to seed the sequence) and print them to the console. At the end of your program, compute the golden ratio by dividing the last number by the second to the last number. A model application is shown on the next page. Don't make this program more difficult than it needs to be. Yes, it will require some initial thought, but the solution really is rather simple. Follow these tips: - Create three integer variables - such as lastNumber (start at 1), nextToLastNumber (start at 0 ), and sum. - Add lastNumber and nextToLastNumber and put the result in sum. You've now generated the next Fibonacci number in the series. - Now it's time to play musical variables. The value of lastNumber will be placed in nextToLast number, the value of sum will be placed in lastNumber, and now you are ready to compute the new sum. Note: If you're using ints to store your Fibonacci numbers, you will lose the decimal portion when you try to divide at the end (for the golden ratio). You can cast your quotient to one of the floating point types (double, float, decimal) to avoid this: double golden = (double) lastNum / nextToLastNum; or decimal golden =( decimal ) lastNum / nextToLastNum; Console. Writeline() will allow you to write a line of output. Console.ReadKey() will allow you to pause the screen at the end if necessary. Sample program output

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!