Yazı gelme olasılıgı
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <conio.h>
int main(int argc, char *argv[]) {
int
i,a,b,c,t,k,l;
srand(time(NULL));
for(i=0;i<=100;i++)
a=rand()%2;
if(a==1)
t+=1;
}
for(i=0;i<=1000;i++)
{
b=rand()%2;
if(b==1)
k+=1;
}
for(i=0;i<=10000;i++)
{
c=rand()%2;
if(c==1)
l+=1;
}
printf("100
atista yazi gelse olasiligi yuzde %d \n ",t);
printf("1000
atista yazi gelse olasiligi binde %d \n ",k);
printf("10000
atista yazi gelse olasiligi onbinde %d \n ",l);
system("PAUSE");
return
0;
}
Hiç yorum yok:
Yorum Gönder