using System;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
int a, b, c;
double result;
Console.Write("Введите a: ");
a = Convert.ToInt32(Console.ReadLine());
Console.Write("Введите b: ");
b = Convert.ToInt32(Console.ReadLine());
Console.Write("Введите c: ");
c = Convert.ToInt32(Console.ReadLine());
if (a != 0)
{
if (b == 0)
{
result = Math.Sqrt(c * -1 / (double)a);
Console.WriteLine("\nx1 = " + result + "\nx2 = " + (result * -1));
}
else if (c == 0)
{
result = b * -1 / (double)a;
Console.WriteLine("\nx1 = 0" + "\nx2 = " + result);
}
else
{
double sqrtD = Math.Sqrt(b * b - 4 * a * c);
Console.WriteLine("\nx1 = " + ((b * -1 + sqrtD) / 2 * a) + "\nx2 = " + ((b * -1 - sqrtD) / 2 * a));
}
}
else
Console.WriteLine("\nОшибка! (a = 0)");
Console.ReadKey();
}
}
}