java---一元二次方程练习

public class wu{

   public static void main(String[] args){
      int a = 2,b = 1, c = 0,d = b*b-4*a*c
      if (a == 0){
          System.out.println("不是一元二次方程");
      }
      else if(a != 0){
          if (d > 0){
              System.out.println("有两个不等实根");
          }
          else if(d == 0){
              System.out.println("有两个相等实根");
          }
          else{
              System.out.println("无实根");

          }
      }
       
       
      }
}

 

posted @ 2015-12-03 21:18  秦萧不再  阅读(672)  评论(0编辑  收藏  举报