#include <math.h>
int main(){
double b,u,n,i,r,x;
u=4.0*3.1416*1E-07;
n=500.0;
i=500.0;
printf("input r:\n"); scanf("%lf", &r);
printf("input x:\n"); scanf("%lf", &x);
b = (u*r*r*n*i)/2.0/ pow(r*r+x*x,1.5);
printf("b=%lf", b);
return 0;
}
輸入 110 和 0
輸出 b=0.001428
請註意物理量的單位,根據單位,自己調整壹下程序。
pow() 是 冪函數計算。