C语言二元一次方程,# include # include int main(void){//把三个系数保存到计算机中int a = 1:int b = 2:int c = 3:double detla:double x1:double x2:detla = b*b - 4*a*c:if (delta > 0){x1 = (-b + sqrt(delta)) / (2*a):x2 = (-b - sqrt(delta
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/24 23:18:15
C语言二元一次方程,# include # include int main(void){//把三个系数保存到计算机中int a = 1:int b = 2:int c = 3:double detla:double x1:double x2:detla = b*b - 4*a*c:if (delta > 0){x1 = (-b + sqrt(delta)) / (2*a):x2 = (-b - sqrt(delta
C语言二元一次方程,
# include
# include
int main(void)
{
//把三个系数保存到计算机中
int a = 1:
int b = 2:
int c = 3:
double detla:
double x1:
double x2:
detla = b*b - 4*a*c:
if (delta > 0)
{
x1 = (-b + sqrt(delta)) / (2*a):
x2 = (-b - sqrt(delta)) / (2*a);//这个是引号
printf("该一元二次方程有两个解,xi = %f,x2 = %f\n",x1,x2):
}
else if (delta == 0)
{
x1 = (-b) / (2*a):
x2 = x1;//这个是引号
printf("该一元二次方程有两个相同解,x1 = x2 = %f\n",x1,x2):
}
else
{
printf("无解\n"):
}
return 0:
}
C语言二元一次方程,# include # include int main(void){//把三个系数保存到计算机中int a = 1:int b = 2:int c = 3:double detla:double x1:double x2:detla = b*b - 4*a*c:if (delta > 0){x1 = (-b + sqrt(delta)) / (2*a):x2 = (-b - sqrt(delta
C语言结尾是分号啊; 你打个冒号
中间你把detla打成delta
最后 是一元二次方程