求方程axx+bx+c=0的根
#include<stdio.h>
#include<math.h>
main()
{
int a,b,c,k,r;
float x1,x2;
printf("\nplease input three bits:\n");
scanf("%d %d %d",&a,&b,&c);
printf("\nthe fangcheng is : %dxx+%dx+%d=0\n",a,b,c);
k=b*b-4*a*c;
if(k>0)
{r=sqr(k);
x1=((-b)+r)/(2*a);
x2=((-b)-r)/(2*a);
printf("\nthe result are: %f %f\n",x1,x2);}
else
printf("\nit is not content for fangcheng\n");
}
int sqr(int y)//求开方的函数;
{ int s;
s=pow(y, 0.5);//调用库函数;
return s;
}
这个程序有点错误,运行不起来!各位高手帮我看一下好吗?