I need to complete a task - to implement a solution to a formula in C#, but the result in the console is not what I need. The result should be -11.84361, but the console outputs 15.1676628055975. What's wrong with the code? What to fix?
namespace Exercise10
{
class Program
{
static void Main()
{
Number number1 = new Number();
number1.Z();
Console.ReadKey();
}
}
class Number
{
double x, y, znamenatel, znamenatelh, virazhenie;
public void Z()
{
M:
Console.Write("Введите число x: ");
x = double.Parse(Console.ReadLine());
Console.Write("Введите число y: ");
y = double.Parse(Console.ReadLine());
znamenatelh = Math.Pow(Math.E, 2) - Math.Pow(x + y, 3 / 4);
if (znamenatelh < 0)
{
Console.WriteLine("Нельзя извлечь корень из отрицательного числа. Введите числа заново.");
goto M;
}
znamenatel = Math.Pow(znamenatelh, 1 / 3);
if (znamenatel == 0)
{
Console.WriteLine("Нельзя делить на нуль. Введите числа заново.");
goto M;
}
void Z_()
{
virazhenie = (x / znamenatel) + Math.Pow(Math.Pow(x - y, Math.Sin(x * y)) / znamenatel, 7 / 3);
Console.Write($"Z({x}, {y}) = {virazhenie}");
}
Z_();
}
}
} // <---- for some reason leaves the block
Here is all the information about the program and what should happen.