Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
120465-11.1-3E
//gcc 7.4.0 #include <stdio.h> #include<stdlib.h> int experiment(void) { float sim; int j,nDeclined; nDeclined=0; int event=0; for(j=0;j<300;j++) { sim=rand()/((float) RAND_MAX); if(sim<0.35) { nDeclined++; } if(nDeclined>100) { event=1; return event; } } return event; } int main() { int i,n,counter; time_t t; srand((unsigned)time(&t)); for(n=10;n<10000000;n*=10) { counter=0; for(i=0;i<n;i++) { counter=counter+experiment(); } printf("For n=%d\t P(A)=%.5f\n",n,counter/((float) n)); } return(0); }
run
|
edit
|
history
|
help
0
polymorphism simulation in plain C with a simple structures
A_141205_Palindromo
18BCE2182 MIDTERM QUES-2
20171117_FUNCIONES
A_141205_ContadorPalabras
Thread and Mutex Code
MyWall1
fibonacci2
TAREA M4- PERLAS TERMINADA
SAI_1-5.c