09/01/07 22:06:48
>>367
#include <stdio.h>
int main(void)
{
int r = 12345, a = 997, c = 1, m = 65536;
double x, sum = 0.0;
int i;
for (i = 0; i < 100; i++) {
r = r*a + c;
r = r % m;
x = (double)r/m;
sum += x;
printf("%.4f ", x);
if (i % 10 == 9) {
putchar('\n');
}
}
printf("\nmean=%.4f\n", sum / 100.0);
return 0;
}