Guest User

Untitled

a guest
Jan 17th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace console
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. WorkingWithStrings();
  11. Console.WriteLine(Fib(2000));
  12. }
  13.  
  14. static int Fib(int count)
  15. {
  16. var nums = new List<int> {1, 1};
  17. int i = 3;
  18. while (i++ <= count) {
  19. var t = nums[nums.Count - 1];
  20. var p = nums[nums.Count - 2];
  21. nums.Add(t + p);
  22. }
  23. return nums[count - 1];
  24. }
  25.  
  26. static void WorkingWithStrings ()
  27. {
  28. var names = new List<string>{"Li lei", "Han meimei", "David"};
  29. foreach (var name in names) {
  30. Console.WriteLine($"Hello {name}");
  31. }
  32. }
  33. }
  34. }
Add Comment
Please, Sign In to add comment