方程

public class fangcheng {

    public static void main(String[] args) {

        int a = 10, b = 20, c = 30;

        if (a == 0) {
            System.out.println("不是一元二次方程");
        } else {
            int d = b * b - 4 * a * c;
            if (d == 0) {
            } else if (d > 0) {
                System.out.println("两个不相等的实根");
            } else if (d == 0) {
                System.out.println("两个相同的实根");
            } else {
                System.out.println("没有实根");
            }
        }

    }

}
原文地址:https://www.cnblogs.com/ljxe/p/5018279.html