Guest User

Untitled

a guest
Dec 9th, 2019
87
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Collections;
  7.  
  8. namespace fibonacci
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. Queue<int> fib = new Queue<int>();
  15. Console.Write("Kolikate cislo: ");
  16. int index = int.Parse(Console.ReadLine());
  17. fib.Enqueue(0);
  18. fib.Enqueue(1);
  19. for (int i = 0; i < index - 1; i++)
  20. {
  21. fib.Enqueue(fib.Dequeue() + fib.Peek());
  22. }
  23. fib.Dequeue();
  24. Console.Write("{0}. prvek: {1}",index,fib.Peek());
  25. Console.ReadLine();
  26. }
  27. }
  28. }
RAW Paste Data