Where's the mistake?



  •   Console.Write("Введите натуральное число больше 2. n= ");
            int n = Convert.ToInt32(Console.ReadLine());
            Console.Write("Введите натуральное число k= ");
            string k = Convert.ToString(Console.ReadLine());
            bool g = Convert.ToBoolean(n);
            bool h = Convert.ToBoolean(k);
            int u = Convert.ToInt32(k);
            int i = 3;
            var a = 1;
            var b = 1;
            int f = 0;
            if (u < 3)
            {
                f = 1;
            }
            else
            {
                for (i = 3; h; i++) {
                    f = a + b;
                    a = b;
                    b = f;
                }
    
            }
    
                Console.Write(k, "-е число Фибоначчи = " + f);
                Console.Write("Первые ", n, " членов Фибоначчи:");
    
                Console.Write("1 1");
                var s = 2;
            for (i=3; g; i++) 
            {
                f = a + b;
                Console.Write(f +" ");
                s = s + f;
                a = b;
                b = f;
            }
            Console.WriteLine(" ");
            Console.WriteLine("Сумма =" + s);
            if (s % 2 == 0)
            {
                Console.WriteLine("Верно что сумма четная");
            }
            else 
            {
                Console.WriteLine("Не верно что сумма четная");
            }
            Console.ReadKey();\
    


  • Console.ReadKey();\
    

    At least here.


Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2