Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Grupa5Nagly
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. {
  14.  
  15. int n, i, f, f0, f1;
  16.  
  17. Console.Write("Podaj wartosc n: ");
  18. while (int.TryParse(Console.ReadLine(), out n) == false || n < 0)
  19. {
  20. Console.WriteLine("wartość jest błędna");
  21. Console.Write("Podaj poprawna wartosc: ");
  22. }
  23.  
  24. f = n;
  25.  
  26. if (n > 1)
  27. {
  28. f0 = 0;
  29. f1 = 1;
  30. i = 2;
  31.  
  32. while (i <= n)
  33. {
  34. f = f0 + f1;
  35. f0 = f1;
  36. f1 = f;
  37. i++;
  38. }
  39.  
  40. }
  41.  
  42. Console.WriteLine("Wartość f: {0}", f);
  43.  
  44. Console.ReadKey();
  45.  
  46.  
  47.  
  48.  
  49.  
  50. //double A, eps, x;
  51. //int licz=0;
  52. //Console.WriteLine("SuperSoft Company 2016");
  53. //Console.WriteLine("Obliczanie Delt i innych pokemonów");
  54. //Console.WriteLine();
  55.  
  56. //Console.Write("Podaj wartosc A: "); //A = Convert.ToDouble(Console.ReadLine());
  57. //while (double.TryParse(Console.ReadLine(), out A) == false || A < 0)
  58. //{
  59. // Console.WriteLine("wartość jest błędna");
  60. // Console.Write("Podaj poprawna wartosc: ");
  61. //}
  62.  
  63. //eps = 1e-7;
  64. //x = 1;
  65.  
  66. //while(Math.Abs((x*x)-A)>eps)
  67. //{
  68. // licz++;
  69. // x = (x + A / x) / 2;
  70. //}
  71.  
  72. //Console.WriteLine("pierw({0})= {1:F5} bo {1:F5} * {1:F5} = {2:F5}", A,x,x*x);
  73. //Console.WriteLine("Kroki: {0}", licz);
  74.  
  75. //Console.ReadKey();
  76.  
  77. //int Aa = A;
  78.  
  79. //int licznik = 0;
  80.  
  81. //while (A != B)
  82. //{
  83. // Console.WriteLine();
  84. // Console.WriteLine("A={0} B={1}",A, B);
  85. // Console.WriteLine();
  86. // licznik++;
  87.  
  88. // if (A > B)
  89. // {
  90. // A = A - B;
  91. // }
  92. // else
  93. // {
  94. // B = B - A;
  95.  
  96. // }
  97. //}
  98.  
  99. //Console.WriteLine("NWD {0} i {1} = {2}", Aa,Bb,A);
  100. //Console.WriteLine("Liczba wykonanych operacji: {0}", licznik);
  101.  
  102. //Console.Write("Podaj długość boku B: ");
  103. ////B = Convert.ToDouble(Console.ReadLine());
  104.  
  105. //Console.Write("Podaj długość boku C: ");
  106. ////C = Convert.ToDouble(Console.ReadLine());
  107.  
  108. //Console.WriteLine();
  109.  
  110. //if (A > B && A > C)
  111. //{
  112. // Max = A;
  113. //}
  114. //else if (B > C)
  115. //{
  116. // Max = B;
  117. //}
  118. //else
  119. //{
  120. // Max = C;
  121. //}
  122. //Console.WriteLine("Najwieksza z podanych jest: {0}", Max);
  123. }
  124. }
  125. }
  126. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement