不确定这里的问题是什么,但我一直得到0的结果。预期结果是0.2222222。我想我必须为我的一个变量分配一个零,但我不知道这是在哪里发生的。任何帮助,将不胜感激。谢谢
#include <stdio.h>
#include <math.h>
int main()
{
double vs = 10;
double rs = 100;
double rl_start = 50;
double rl_stop = 150;
double rl_step = 5;
double i, j;
double n = rl_start;
int count;
do
{
j = ((rl_start) + (rl_step * count));
i = (pow(vs, 2) * j) / pow((rs + j),2);
printf("%lf", i);
count++;
}while(j <= rl_stop);
return 0;
}
最佳答案
使用前需要初始化count
:int count = 0;
关于C 数学和零结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10492652/