Untitled

mail@pastecode.io avatar
unknown
csharp
7 months ago
1.5 kB
2
Indexable
Never
using System;

namespace Console_Practical
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("a: ");
            double a = double.Parse(Console.ReadLine());

            Console.Write("b: ");
            double b = double.Parse(Console.ReadLine());

            Console.Write("c: ");
            double c = double.Parse(Console.ReadLine());

            Console.Write("d: ");
            double d = double.Parse(Console.ReadLine());

            Console.Write("e: ");
            double e = double.Parse(Console.ReadLine());

            double[] doubles = { a, b, c, d, e };

            foreach (double dbl in doubles)
            {
                if (dbl < 0 || dbl > 100000)
                {
                    Console.WriteLine($"Число {dbl} не находится в промежутке от 0 до 100 000.");
                    Environment.Exit(-1);
                }
            }

            double s = Math.Sqrt((b - e + a)) / Math.Sqrt((d - 1));
            double k = Math.Sqrt(((c - 11 * b) / (b - e + a)));

            if (double.IsNaN(s) || double.IsNaN(k))
            {
                Console.WriteLine("ERROR");
            }
            else
            {
                Console.WriteLine($"s = {Math.Round(s, 2)}");
                Console.WriteLine($"k = {Math.Round(k, 2)}");
            }

        }
    }
}
Leave a Comment