// Copyright (c) 2014软件技术1班
// All rights reserved.
// 作 者:A35卢杰林
// 完成日期:2014年 10 月 26 日
// 版 本 号:v1.0
//
// 问题描述:编程解一元二次方程
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
double x1, x2, a, b, c;
Console.WriteLine("求ax^2+bx+c=0的解");
Console.WriteLine("请输入第一个数值");
a = Convert.ToInt32(Console.ReadLine());
Console.Beep();
Console.WriteLine("请输入第二个数值");
b = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("请输入第三个数值");
Console.Beep();
c = Convert.ToInt32(Console.ReadLine());
x1 = (-b + Math.Sqrt(b * b - 4 * a * c)) / 2 * a;
x2 = (-b - Math.Sqrt(b * b - 4 * a * c)) / 2 * a;
Console.WriteLine("{0}:{1}", x1, x2);
Console.Read();
}
}
}