2020.8.29第五十四天
例13.1
1 import java.util.Scanner; 2 public class cjava { 3 public static void main(String[] args) { 4 float a,b,c,disc; 5 System.out.println("please input a,b,c:"); 6 Scanner s=new Scanner(System.in); 7 a=s.nextFloat(); 8 b=s.nextFloat(); 9 c=s.nextFloat(); 10 if(a==0) 11 { 12 System.out.println("a is equal to zero,error!"); 13 } 14 else 15 if((disc=b*b-4*a*c)<0) 16 { 17 System.out.println("disc=b*b-4*a*c<0"); 18 } 19 else 20 { 21 System.out.println("x1 = "+((-b+Math.sqrt(disc))/(2*a))); 22 System.out.println("x2 = "+((-b-Math.sqrt(disc))/(2*a))); 23 } 24 } 25 26 }
2.遇到的问题:无
3.明天继续写例题