Answer the question
In order to leave comments, you need to log in
Where is my error in the while loop?
static void Main(string[] args)
{
double x, b, h;
Console.Write("Введитe x: ");
x = double.Parse(Console.ReadLine());
Console.Write("Введите b: ");
b = double.Parse(Console.ReadLine());
Console.Write("Введите шаг вычисления h: ");
h = double.Parse(Console.ReadLine());
double y = 0;
while (y <= b)
{
if (x < 0) y = Math.Pow((Math.Pow(x, 3) + 1), 2);
else if (0 <= x && x < 1) y = 0;
else if (x >= 1) y = Math.Abs(Math.Pow(x, 2) - 5 * x + 1);
x += h;
Console.WriteLine("Таблица значений функций: " + y);
}
}
Answer the question
In order to leave comments, you need to log in
while (x <= b), it is necessary because x ∈ [a,b] with step h.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question