#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
//주사위
int dice[10];
srand(time(NULL));
int num[6] = {0, 0, 0, 0, 0, 0};
for(int i=0;i<10;i++){
dice[i] = rand() % 6+1;
switch(dice[i]){
case 1:
num[0] += 1;
break;
case 2:
num[1] += 1;
break;
case 3:
num[2] += 1;
break;
case 4:
num[3] += 1;
break;
case 5:
num[4] += 1;
break;
case 6:
num[5] += 1;
break;
}
}
int max_num = 1;
for(int i=0;i<6;i++){
if(num[i] > num[max_num]){
max_num = i;
}
}
printf("제일 많이 나온 값: %d %d번", max_num+1, num[max_num]);
}
To embed this project on your website, copy the following code and paste it into your website's HTML: