C语言70分求助 3,6,8测试点不通过
查看原帖
C语言70分求助 3,6,8测试点不通过
1053560
Kotori_Kawaii楼主2023/9/20 10:55
#include<stdio.h>
#include<math.h>
int main()
{
	double a, b, c,d;
	scanf("%lf %lf %lf",&a,&b,&c);
	float x1=( - b + sqrt(b * b - 4 * a * c))/2/a;
	float x2 = (-b - sqrt(b * b - 4 * a * c)) / 2 / a;
	d = b * b - 4 * a * c;
		if(d>=0){
	if (x1 ==x2) {
		printf("x1=x2=%.5lf", x2);
	}
	else if(x1<x2){
		printf("x1=%.5lf;x2=%.5lf", x1, x2);
	}else if(x1>x2){
	    printf("x1=%.5lf;x2=%.5lf", x2, x1);
	}
	
		
		}
		else {
			printf("No answer!");
		}
	return 0;
}

求助大佬

2023/9/20 10:55
加载中...