人家

来源:互联网 发布:1米网络机柜 编辑:程序博客网 时间:2024/04/27 16:56
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace P1_01HelloWorld
{
    class Class1
    {


        static void Main(string[] args)
        {
            double a, b, c;








            Console.WriteLine("请输入a,b,c的值");
            a = Convert.ToDouble(Console.ReadLine());


            b = Convert.ToDouble(Console.ReadLine());


            c = Convert.ToDouble(Console.ReadLine());
            if (Math.Pow(b, 2) - 4 * a * c >= 0)
            {


                Console.WriteLine("x1=" + (-b + Math.Sqrt(b * b - 4 * a * c)) / (2 * a));
                Console.WriteLine("x2=" + (-b + Math.Sqrt(b * b - 4 * a * c)) / (2 * a));
            }
            else
            {
                Console.WriteLine("无解!");


                Console.Read();


            }


        }
    }
}
0 0