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;
- namespace Hello_Name_
- {
- class Program
- {
- static void Main(string[] args)
- {
- int number = int.Parse(Console.ReadLine());
- Console.WriteLine(PrintFib(number));
- }
- static int PrintFib(int number)
- {
- int a = 0;
- int b = 1;
- for (int i = 0; i<=number; i++)
- {
- int fibNumber =a;
- a =b;
- b = fibNumber+b;
- }
- return a;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement