两个方程式求解
来源:互联网 发布:vue2.0监听数据变化 编辑:程序博客网 时间:2024/04/29 08:36
#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,10.000000x1=0x2=-1074790400请按任意键继续. . .*/