// Copyright (c) 2014软件技术1班
// All rights reserved.
// 作 者:A37
// 完成日期:2014年 10 月 27 日
// 版 本 号:v1.0
//问题描述:编写一个程序,可以解一元二次方程
//输入描述:三个任意数a,b,c
//程序输出:两个实数x1,x2
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
double a, b, c,x1,x2;
Console.WriteLine("请输入a的值");
a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("请输入b的值");
b = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("请输入c的值");
c = Convert.ToInt32(Console.ReadLine());
x1 = (-(b* b)+ Math.Sqrt(b * b - 4 * a * c)) / 2 * a;
x2 = (-(b * b) - Math.Sqrt(b * b - 4 * a * c)) / 2 * a;
Console.WriteLine("{0},{1}",x1,x2);
Console.Read();
}
}
}