#include<stdio.h>
#include <math.h>
int main()
{
float pb;
float N;
float ro;
float nb;
printf(" Now we will find the number of charges and users \n \n \n ");
printf(" Please enter the probability \n ");
printf(" The probability is ");
scanf("%f",&pb);
printf("\n \n Please enter the number of circuits N \n");
printf("The number is");
scanf("%f",&N);
while ( pb>0.01 )
{
pb=1/(1+N/(ro*pb));
ro=ro+0.01;
}
printf("%f",ro);
}
答案 0 :(得分:2)
您至少需要初始化您未从用户读取的所有变量。现在,你正在使用一些“随机”值进行数学运算。
答案 1 :(得分:1)
pb=1/(1+N/(ro*pb));
在上面的程序中使用ro并且未初始化,因此您的计算不会按预期结束。