Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
2.6 kB
14
Indexable
Never
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace Test
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Enter the value of f: ");
            bool firstValue = double.TryParse(Console.ReadLine(), out double f); 

            Console.Write("Enter the value of g: ");
            bool secondValue = double.TryParse(Console.ReadLine(), out double g);

            Console.Write("Enter the value of e: ");
            bool thirdValue = double.TryParse(Console.ReadLine(), out double e);

            bool validData = firstValue && secondValue && thirdValue ? true : false;

            bool firstExpression = validData;
            double a = 1.0;
            firstExpression = validData ?
                (g + e != 0 && 25 - g != 0 ? double.TryParse(((Math.Pow(f - g, 3) - 7) / Math.Pow(g + e, 2) + 7 * (e * f - f * f * g / 3) / (25 - g)).ToString(), out a) :
                false) : false;

            bool secondExpression = firstExpression;
            double x = 1.0;
            secondExpression = firstExpression ?
                (g - e != 0 ? double.TryParse((43 * 43 * a - 42 * 42 * g / 27.3 + (16 + g) / (g - e)).ToString(), out x) :
                false) : false;

            bool thirdExpression = secondExpression;
            double w = 1.0;
            thirdExpression = secondExpression ?
                (x != 0 && f != 0 && e + g * g != 0 ? double.TryParse((x / 100 + 25 * 25 / x + a / (3 * f) - (g + e * e) / (e + g * g)).ToString(), out w) :
                false) : false;

            bool fourthExpression = thirdExpression;
            double h = 1.0;
            fourthExpression = thirdExpression ?
                (f != 0 && e != 0 ? double.TryParse((g - f * f - 7 * e * e * w / 3 - x * x / (4.5 * f * e)).ToString(), out h) :
                false) : false;

            Console.WriteLine(!validData ? "Неверные входные данные" : (firstExpression ? 
                (secondExpression ? (thirdExpression ? (fourthExpression ? $"{a:f3} {x:f3} {w:f3} {h:f3}" :
                $"{a:f3} {x:f3} {w:f3} " + "Невозможно произвести расчёт") : $"{a:f3} {x:f3} " + "Невозможно произвести расчёт") : 
                $"{a:f3} " + "Невозможно произвести расчёт") : "Невозможно произвести расчёт"));

        }
    }
}