p43-3.4

来源:互联网 发布:淘宝的卖家中心在哪里 编辑:程序博客网 时间:2024/06/14 17:31
这里写代码片#include <math.h>#include <stdio.h>int main (){    float a,b,c,x1,x2;    printf("请输入a,b,c的值,以空格隔开,以回车键结束:");    scanf("%f%f%f",&a,&b,&c);    x1=(b*(-1)+sqrt(b*b-4*a*c))/(2*a);    x2=(b*(-1)-sqrt(b*b-4*a*c))/(2*a);    printf("x1=%f\n,x2=%f\n",x1,x2);}

这个程序的运程结果为
这里写图片描述