Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- public static int Fibonacci(int n)
- {
- int a = 0;
- int b = 1;
- for (int i = 0; i <= n; i++)
- {
- int temp = a;
- a = b;
- b = temp + b;
- }
- return a;
- }
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- Console.WriteLine(Fibonacci(n));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment