using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication24
{
class Program
{
static void Main(string[] args)
{
double a, b, c;
Console.Write("a=");
a = Convert.ToDouble(Console.ReadLine());
Console.Write("b=");
b = Convert.ToDouble(Console.ReadLine());
Console.Write("c=");
c = Convert.ToDouble(Console.ReadLine());
double d = b * b - 4 * a * c;
double x1, x2;
if (d > 0)
{
x1 = (-b - Math.Sqrt(d)) / 2.0 / a;
x2 = (-b + Math.Sqrt(d)) / 2.0 / a;
Console.WriteLine("方程有两个不同的实根\nx1={0}\nx2={1}", x1, x2);
}
else if (d == 0)
{
x1 = x2 = (-b) / 2.0 / a;
Console.WriteLine("方程有两个相同的实根\nx1={0}\nx2={1}", x1, x2);
}
else if (d < 0)
{
Console.WriteLine("方程无解");
}
Console.Read();
}
}
}