-4
#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);
}
4

2 に答える 2

2

少なくとも、ユーザーから読み取らないすべての変数を初期化する必要があります。現在、「ランダムな」値を使用して計算を行っています。

于 2013-04-05T10:01:37.390 に答える
1
pb=1/(1+N/(ro*pb));

上記のプログラムでは、ro を使用しており、初期化されていないため、計算が期待どおりに終了しません。

于 2013-04-05T10:13:33.727 に答える