using System;
namespace уравнение
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Решаем квадратное уравнение");
Console.WriteLine("Введите а=");
var a = double.Parse(Console.ReadLine());
Console.Write("Введите b="
var b = double.Parse(Console.ReadLine());
Console.Write("Введите с=");
var c = double.Parse(Console.ReadLine());
var d = b * b - 4 * a * c;
if (a == 0)
{
if (b == 0 && c == 0) Console.WriteLine("Множество решений");
else
if (b == 0) Console.WriteLine("Решений нет");
else Console.WriteLine("Один корень x={0}", -c / b);
}
else
{
if (d < 0) Console.WriteLine("Решений нет");
else if (d == 0) Console.WriteLine("Квадратный корень x={0}", -b / 2 / a);
{
var x1 = (-b + Math.Sqrt(d)) / 2 / a;
var x2 = (-b - Math.Sqrt(d)) / 2 / a;
Console.WriteLine("x1 ={0},x2 ={1}", x1, x2);
}
}
Console.ReadKey();
}
}
}