Question: Your Program C# The Fibonacci sequence is a numerical sequence following the pattern: 1 , 1 , 2 , 3 , 5 , 8 ,

Your Program C#
The Fibonacci sequence is a numerical sequence following the pattern:
1,1,2,3,5,8,13,21,34,55,...
By definition, the first two numbers are 1 and 1, and each subsequent number is the sum of the previous
two. For your program, you will ask the user to enter a number, n, and then calculate and display the
values of the Fibonacci sequence to the nth position.
Your output should look similar to the sample output. Submit your completed program through
Blackboard, as usual.
Challenge
For the challenge component this week, modify your program to write the output not only to the
screen, but also to a separate text file, Fibonacci.txt
**Can you be specific on c# code and all steps it's asking in the program especially loops. Can you also be detailed on how to modify program to a separate text file (fibonacci.txt)**
Enter an integer value to see the Fibonacci sequence to that position: 15
The values of the Fibonacci sequence to the 15th position are:
Press any key to continue ...
If you can make c# code similar to the the second img I attached.
Enter an integer value to see the Fibonacci sequence to that position: 15
The values of the Fibonacci sequence to the 15th position are:
Press any key to continue ... Enter an integer value to see the Fibonacci sequence to that position: 15
The values of the Fibonacci sequence to the 15th position are:
Press any key to continue ... Enter an integer value to see the Fibonacci sequence to that position: 15
The values of the Fibonacci sequence to the 15th position are:
Press any key to continue ... Enter an integer value to see the Fibonacci sequence to that position: 15
The values of the Fibonacci sequence to the 15th position are:
1
1
2
3
8
8
13
21
34
55
89
Press any key to continue ...
```
psing aysvem?
using System.Collections,Generic;
using System.Ling;
using System.Text;
asing System.Thresding.Tsaks;
asing Syacem.10; // Required for our StreamReader and Streamifiter objecka.
sanespace Demo_Project
El
clag: Sequenceg_For
I
static vold Masn(stying[] args)
I
Int limit =?/// This variable ulll set the limit on our loop.
// In this case, our loop w11l print out 15 values.
int currentVal =1s // This variable mill store the current value of our sequence.
// In the case of triangular numbers, we start our sequence at 1.
for (int 1=1; limit; i++)// This loop starts at 1, and wili run while i is less than or equal to the limit.
|// In toksl, this loop will run 15 times, as it increments i by l esch time.
Console.WriteLine (currentVal); // We print out the current value of our sequence....
currentVsl = currentVsi +(i +); // And calculate the next value, storing it in currentVal, for the next iteration.
// For erisagalar numbera, we add 2, chen add $, thea add 4, eve.
// Sinee our loop conerol variable, d, ia takisg values 1,2,3, eEe, we can add
//(1+1) Eo follou Ehla patcera.
1
Console.Write("Preas any key to continue...");
Console.ReadKey():
1
1
1
```
Your Program C# The Fibonacci sequence is a

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 Programming Questions!