欧美一区二区三区,国内熟女精品熟女A片视频小说,日本av网,小鲜肉男男GAY做受XXX网站

python題求解輸入a

python題求解輸入a?

import java.util.Scanner;

//ax^2+bx+c=0 求根

public class TestTwo {

public static void main(String[] args) {

double a,b,c;

Scanner sc=new Scanner(System.in);

System.out.println("輸入a,b,c三個(gè)數(shù):");

System.out.print("輸入數(shù)a:");

a=sc.nextDouble();

System.out.print("輸入數(shù)b:");

b=sc.nextDouble();

System.out.print("輸入數(shù)c:");

c=sc.nextDouble();

qiuRoot(a, b, c);

}

static void qiuRoot(double a,double b,double c) {

double x1=0,x2=0;

double realpart=0, imagepart=0;

double disc=0;

//if(a!=0)

//float f1=3.0f; //3.00000000003214343214

//float f2=3.0f;//3.0000000000006453646543

if(Math.abs(a)<1e-6) { //說(shuō)明a=0

System.out.println("這不是一個(gè)一元二次方程");

System.exit(0);

}else {

System.out.println("一元二次方程");

disc=b*b-4*a*c;

}

if(Math.abs(disc)<1e-6) {

System.out.println("有兩個(gè)相等的根:"+(-b/(2*a)));

}else if (Math.abs(disc)>=1e-6) {

x1=(-b+Math.sqrt(disc))/(2*a);

x2=(-b-Math.sqrt(disc))/(2*a);

System.out.println("有兩個(gè)不相等的根:"+"x1="+x1+" x2="+x2);

}else {