#include <stdio.h>
#include <stdlib.h>
/* main */
int main(void){
int x;
int i;
/* Throw the dice 20 times */
for (i=1; i<=20; i++)
{
/* use the function rand() to simulation the random result */
x= 1 + rand() % 6; /* 6 is the zoom factor, make sure the result between 0~5*/
printf("%d", x);
/* print 5 results every line */
if (i % 5 == 0)
{
printf("\n");
}
}
return 0;
}
掷骰子20次 统计结果
最新推荐文章于 2021-05-21 02:10:44 发布