Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace epka
- {
- class Program
- {
- static int licz = 0;
- /*static int Sil (int n)
- {
- Console.WriteLine(n);
- if (n == 0) return 1;
- else return n * Sil(n - 1);
- }*/
- static int Fib(int n)
- {
- //Console.WriteLine(n);
- licz++;
- if (n == 0) return 1;
- if (n == 1) return 1;
- else return Fib(n - 1)+ Fib(n - 2);
- }
- static void Main(string[] args)
- {
- int n, w;
- Console.WriteLine("Podaj n:");
- n = int.Parse(Console.ReadLine());
- DateTime czas = DateTime.Now;
- //w = Sil(n);
- Console.WriteLine("{0}! = {1}", n, Fib(n));
- DateTime czas1 = DateTime.Now;
- Console.WriteLine("Czas operacji:{0}", czas1.Ticks - czas.Ticks);
- Console.WriteLine(licz);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement