根运算程序那里错了啊,帮我瞧瞧撒
不知道是那里错了。。。。程序可以运行,但是运算却出现错误,大侠帮我瞧瞧
出错图片.rar
(3.31 KB)
#include <stdio.h>
#include <math.h>
void main()
{
int f_a=0;
int f_b=0;
int f_c=0;
int f_delta=0;
int f_x1=0;
int f_x2=0;
int f_p=0;
int f_q=0;
printf("\n**********************************************************");
printf("\n* This program is wrote by Brilly *");
printf("\n* ax2+bx+c=0 *");
printf("\n**********************************************************");
printf("\n\n");
printf("请输入a的值:");
scanf("%f",&f_a);
printf("请输入b的值:");
scanf("%f",&f_b);
printf("请输入c的值:");
scanf("%f",&f_c);
printf("\n该方程是:%.2fx2+%.2fX+%.2f=0",f_a,f_b,f_c);
f_delta=f_b*f_b - 4* f_a * f_c;
f_p = - f_b/(2*f_a);
f_q = sqrt ( f_delta ) / ( 2 * f_a );
f_x1 = f_p + f_q;
f_x2 = f_p - f_q;
printf("\n根是:\nx1=%.2f\nx2=%.2f\n",f_x1,f_x2);
}