<commit_before>﻿/*Problem 10. Fibonacci Numbers

    Write a program that reads a number n and prints on the console the first n members of the Fibonacci sequence
    (at a single line, separated by comma and space - ,) : 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, ….

Note: You may need to learn how to use loops.

Examples:
n 	comments
1 	0
3 	0 1 1
10 	0 1 1 2 3 5 8 13 21 34
*/

using System;

class FibonacciNumbers
{
    static void Main()
    {
        Console.Title = "Fibonacci Numbers"; //Changing the title of the console.

        Console.Write("Enter an integer n to see the first n members of the Fibonacci sequence: ");
        int n = int.Parse(Console.ReadLine());
        string[] fiboMembers = new string[n]; // This array will keep the members of the Fibonacci sequence.

        for (long i = 0, previousMember = 0, nextMember = 1, temp; i < n; i++)
        // In the for loop we declare the first two members of the sequence (0 and 1) and a temp variable 
        // needed for the calculations.
        {
            fiboMembers[i] = previousMember.ToString(); //We convert the member to string and we place it in its array position.
            temp = nextMember;//After that we assign the value of the next member to temp.
            nextMember += previousMember;//Then we add the previous member to the next member.
            previousMember = temp;//Finally, we assign the value of the temp to the previous member.
        }
        Console.WriteLine(string.Join(", ",fiboMembers)); //Creating a string in the requested format and printing it.

        Console.ReadKey(); // Keeping the console opened.
    }
}<commit_msg>Update to Problem 10. Fibonacci Numbers<commit_after>﻿/*Problem 10. Fibonacci Numbers

    Write a program that reads a number n and prints on the console the first n members of the Fibonacci sequence
    (at a single line, separated by comma and space - ,) : 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, ….

Note: You may need to learn how to use loops.

Examples:
n 	comments
1 	0
3 	0 1 1
10 	0 1 1 2 3 5 8 13 21 34
*/

using System;

class FibonacciNumbers
{
    static void Main()
    {
        Console.Title = "Fibonacci Numbers"; //Changing the title of the console.

        Console.Write("Enter an integer n to see the first n members of the Fibonacci sequence: ");
        int n = int.Parse(Console.ReadLine());
        string[] fiboMembers = new string[n]; // This array will keep the members of the Fibonacci sequence.

        for (long i = 0, a = 0, b = 1; i < n; i++)// In the for loop we declare a counter i and the first two members of the sequence (0 and 1).
        {
            fiboMembers[i] = a.ToString(); //We convert the member to string and we place it in its array position.
            b = a + b;//Then we add the previous member to the next member.
            a = b - a;//From the new next member we substract the previous member. (b=a+b and so b - a is a+b - a = b)
        }
        Console.WriteLine(string.Join(", ",fiboMembers)); //Creating a string in the requested format and printing it.

        Console.ReadKey(); // Keeping the console opened.
    }
}
{'fraction_non_alphanumeric': 0.090880303989867, 'fraction_numerical': 0.032932235592146926, 'mean_word_length': 2.4829106945975745, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4040224', 'n_tokens_mistral': 1030, 'n_tokens_neox': 900, 'n_words': 460}