C数学和零结果

api*_*hel 1 c

不知道这里有什么问题,但我一直得到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;
}
Run Code Online (Sandbox Code Playgroud)

MBy*_*ByD 6

您需要count在使用之前进行初始化: int count = 0;