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 Grupa5Nagly
- {
- class Program
- {
- static void Main(string[] args)
- {
- {
- int n, i, f, f0, f1;
- Console.Write("Podaj wartosc n: ");
- while (int.TryParse(Console.ReadLine(), out n) == false || n < 0)
- {
- Console.WriteLine("wartość jest błędna");
- Console.Write("Podaj poprawna wartosc: ");
- }
- f = n;
- if (n > 1)
- {
- f0 = 0;
- f1 = 1;
- i = 2;
- while (i <= n)
- {
- f = f0 + f1;
- f0 = f1;
- f1 = f;
- i++;
- }
- }
- Console.WriteLine("Wartość f: {0}", f);
- Console.ReadKey();
- //double A, eps, x;
- //int licz=0;
- //Console.WriteLine("SuperSoft Company 2016");
- //Console.WriteLine("Obliczanie Delt i innych pokemonów");
- //Console.WriteLine();
- //Console.Write("Podaj wartosc A: "); //A = Convert.ToDouble(Console.ReadLine());
- //while (double.TryParse(Console.ReadLine(), out A) == false || A < 0)
- //{
- // Console.WriteLine("wartość jest błędna");
- // Console.Write("Podaj poprawna wartosc: ");
- //}
- //eps = 1e-7;
- //x = 1;
- //while(Math.Abs((x*x)-A)>eps)
- //{
- // licz++;
- // x = (x + A / x) / 2;
- //}
- //Console.WriteLine("pierw({0})= {1:F5} bo {1:F5} * {1:F5} = {2:F5}", A,x,x*x);
- //Console.WriteLine("Kroki: {0}", licz);
- //Console.ReadKey();
- //int Aa = A;
- //int licznik = 0;
- //while (A != B)
- //{
- // Console.WriteLine();
- // Console.WriteLine("A={0} B={1}",A, B);
- // Console.WriteLine();
- // licznik++;
- // if (A > B)
- // {
- // A = A - B;
- // }
- // else
- // {
- // B = B - A;
- // }
- //}
- //Console.WriteLine("NWD {0} i {1} = {2}", Aa,Bb,A);
- //Console.WriteLine("Liczba wykonanych operacji: {0}", licznik);
- //Console.Write("Podaj długość boku B: ");
- ////B = Convert.ToDouble(Console.ReadLine());
- //Console.Write("Podaj długość boku C: ");
- ////C = Convert.ToDouble(Console.ReadLine());
- //Console.WriteLine();
- //if (A > B && A > C)
- //{
- // Max = A;
- //}
- //else if (B > C)
- //{
- // Max = B;
- //}
- //else
- //{
- // Max = C;
- //}
- //Console.WriteLine("Najwieksza z podanych jest: {0}", Max);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement