数学计算公式的输出问题
# include <stdio.h># include <math.h>
main(void)
{
float s1, s2, x1, x2;
int n1, n2;
long float sc, t, t1, t2;
n1 = n2 = 10;
printf("请输入s1和ns2:\n");
scanf("%f %f", &s1, &s2);
printf("请输入x1和x2:\n");
scanf("%f %f", &x1, &x2);
sc = ((n1-1)*s1*s1 + (n2-1)*s2*s2)/(n1 + n2 -2);
t1 =sc * sc * (1/n1 + 1/n2);
t2 = sqrt(t1);
t = (x1 - x2)/t1;
printf("sc = %lf, t1 = %lf, t2 = %lf, t = %lf", sc, t1, t2, t);
return 0;
}
t1和t2输出为0,t输出为垃圾值?请教各位大虾,哪里存在问题?