#include <stdio.h>;
#include <math.h>;
int main (void)
{
double a,b,c,x1,x2,p,q,m;
printf("Please put into the numbers of a b c:\n");
scanf("%1f%1f%1f",&a,&b,&c);
p=b*b-4*a*c;
if (p<0)
{printf("The numbers are wroung\n");
return 0;}
else {
m=sqrt(p)/(2.0*a);
q=-b/(2*a);
x1=q+m;
x2=q-m;
printf("x1=%1f\nx2=%1f",x1,x2);
return 0;
}}
这是求一个一元二次方程组的解的一个C程序,且a不等于0.
两个错误 1. #include <stdio.h>; 不需要分号,这是预处理命令,5. %1f应该是%lf