#include<stdio.h>
#include<math.h>
float Add(float a1,float a2,float a3,float a4,float a5,float a6,float as);
int main()
{
float R1=2682.0,R2=2680.0,R3=2681.4,R4=2680.7,R5=2682.0,R6=2680.9,Rs;
float Uas,Ubs,Ucs,Ua1,Ub1,Uc1,Ucx,U;
Rs=(R1+R2+R3+R4+R5+R6)/6;
Uas=sqrt((1/30)*Add(R1,R2,R3,R4,R5,R6,Rs));
printf("Rs=%f,Uas=%f",Rs,Uas);
return 0;
}
float Add(float a1,float a2,float a3,float a4,float a5,float a6,float as)
{
float b[6]={a1,a2,a3,a4,a5,a6};
float x=0;
int i;
for(i=0;i<6;i++){
x+=(b[i]-as)*(b[i]-as);
}
return x;
}
没有报错但是最终Rs有值,Uas值为0,想知道哪里写错了