Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Numerics;
- namespace _10.FibonacciNumbers
- {
- class FibonacciNumbers
- {
- static void Main()
- {
- Console.WriteLine("Enter a number N for range: ");
- BigInteger n = BigInteger.Parse(Console.ReadLine());
- BigInteger firstNum = 0;
- BigInteger secondNum = 1;
- BigInteger thirdNum = 1;
- for (int i = 0; i < n; i++)
- {
- thirdNum = secondNum;
- secondNum = firstNum + secondNum;
- firstNum = thirdNum;
- Console.Write(firstNum + " ");
- }
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement