框图"里的内容,我不太懂这个,想问你们下,根号b^2-1/4ac写成程序语句表达式是?
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/29 15:32:32
框图"里的内容,我不太懂这个,想问你们下,根号b^2-1/4ac写成程序语句表达式是?
框图"里的内容,我不太懂这个,想问你们下,根号b^2-1/4ac写成程序语句表达式是?
框图"里的内容,我不太懂这个,想问你们下,根号b^2-1/4ac写成程序语句表达式是?
sqrt(b*b - 1/(4*a*c))
------------------
or
void main(void)
{
float a,b,c;
float x,y,z;
float precision = 0.000001;
printf(c\nPlease input the the value of a.\n");
scanf("%f",&a);
printf("\n");
printf("\nPlease input the the value of b.\n");
scanf("%f",&b);
printf("\n");
printf("\nPlease input the the value of c.\n");
scanf("%f",&c);
printf("\n");
x = b*b;
y = 4*a*c;
if( (y < precision) && (y > -precision ) )
{
printf("\n4ac is too closed to zero,can not get the result of b*b - 1/(4ac)\n");
return;
}
z = x - 1/y;
if( z < precision )
{
printf("\nb*b - 1/(4ac) is less than zero,can not get the result of b*b - 1/(4ac).\n");
return;
}
printf("\nb*b - 1/(4ac) = \n%f\n",sqrt(z) );
return;
}