-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path6.c
46 lines (40 loc) · 886 Bytes
/
6.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int Rodagem()
{
return((rand() % 6) + 1);
}
int main(){
int dado, i;
int Um = 0, Dois = 0, Tres = 0, Quatro = 0, Cinco = 0, Seis = 0;
int const QntTestes = 1000000;
srand(time(NULL));
for (i = 0; i < QntTestes+1; i++)
{
switch (Rodagem())
{
case (1):
Um++;
break;
case (2):
Dois++;
break;
case (3):
Tres++;
break;
case (4):
Quatro++;
break;
case (5):
Cinco++;
break;
default:
Seis++;
break;
}
}
printf("\n-----------------\n");
printf("\nUm: %d\nDois: %d\nTres: %d\nQuatro: %d\nCinco: %d\nSeis: %d\n", Um, Dois, Tres, Quatro, Cinco, Seis);
return(1);
}