新手求助啊
程序代码:#include <stdio.h>
int main (void)
{
int i=0,j=0,n=0,a[100],x,b=0,max=1;
int num[49],l=0,k=1;
printf("Enter the balls that are drawn from the machine: \n");
do
{
scanf("%d",&x);
if (x>0&&x<49){
a[i]=x;
i++;
}
}while (i<100 && x>0 && x<49);
printf("\n\nThe values from 1st ball to the 6th ball are: \n");
for(j=0;j<6;j++)
printf("%d ",a[j]);
printf("\n\nThe 10th,20th and 30th balls: \n");
printf("10th ball: %d\n20th ball: %d\n30th ball:%d\n",a[9],a[19],a[29]);
for(j=0;j<i;j++){
if (a[j] >40)
b++;
}
printf("\nThe values are great than 40:%d\n",b);
for(n=0;n<100;n++)
{
if(max<a[n])
max=a[n];
}
printf("\nThe max vaule is : %d\n", max);
for (l=0;l<100;l++)//频率
num[a[l]-1]++;
for(k=1;k<=49;k++)
printf("ball %d was drawn %d times",k,num[k]);
return 0;
}






