#include <stdio.h>
#include "math.h"
int main(int argc, char *argv[])
{
//ax2+bx+c=0方程根 abc键盘输入
//b2-4ac>0
//公式 x1=(-b+sqrt(b2-4ac))/2a
float a,b,c;
float x1,x2, disc;
printf("int put the fangchengshi about a,b,c:");
scanf("%d,%d,%d",&a,&b,&c);
disc= b*b-4*a*c;
printf("%f\n",disc);
if(disc>=0)
{
x1=(-b+sqrt(disc))/(2*a);
x2=(-b-sqrt(disc))/(2*a);
printf("x1=%d\nx2=%d\n",x1,x2);
}
else
printf("the problem is no answer!!");
return 0;
}
/*
int put the fangchengshi about a,b,c:1,2,1
0.000000
x1=0
x2=-1074790400
请按任意键继续. . .
*/
两个方程式求解
最新推荐文章于 2021-03-18 00:08:37 发布