#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main()
{
long a=0,b=0,c=0,i=0,j=0,k=0,x=0,z=0;
int arr[34] = {0},brr[34] = {0} ;
srand((unsigned)time(NULL));
printf("红球 蓝球\n\n ");
for(b=1;b<=20000000;b++) //红蓝球随机出现
{
a=rand() % 33+1;
arr[a]++;
i=rand() % 16+1;
brr[i]++;
}
for(a=1;a<=33;a++)
{
printf("%7d 出现次数 = %3d ",a,arr[a]);
if(a<=16)
printf("%15d 出现次数 = %3d ",a,brr[a]);
printf("\n ");
c=arr[a]+c;
}
printf("红球 蓝球\n\n ");
for (j = 1; j <= 33; j++)
{
for (i = 1; i <= 33; i++)
{
if (arr[i] > x ) //红球从多到少排训
{
x = arr[i];
C语言 双色球 红蓝球出现概率模拟
最新推荐文章于 2024-01-09 23:15:13 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)