建立一个数组存放5个数值,要求连续随机录入5个数并按以下要求输出 (每个数小于 100)

建立一个数组存放5个数值,要求连续随机录入5个数并按以下要求输出 (每个数小于 100)
printf打印要求:

  1. 打印录入的数据
  2. 打印5个数中6的个数(如11,22,33,44,62中含1个6)
  3. 打印5个数中的最大值和最小值
#include<stdio.h>
int countsix(int x)
{
    int t=0;
    if (x > 9)
    {    
        t+=countsix(x/10);
    }
    if(x%10==6) return 1+t;
    else return 0+t;
}
int main(){
    int a[5];
    int maxindex=0,minindex = 0;
    int sixn = 0;
    for(int i=0;i<5;i++){
        scanf("%d",&a[i]);
        if(a[i]>100){
            i=i-1;
            printf("请重新输入:");
            continue;
        }
    }
    for(int i=0;i<5;i++){
        sixn+=countsix(a[i]);
    }
    printf("共有%d个6\n",sixn);
    for(int i=1;i<5;i++){
        if(a[i]>a[maxindex]){
            maxindex = i;
            continue;
        }
            
        if(a[i]<a[minindex]){
            minindex =i;
            continue;
        }
    }
    printf("最大值:%d 最小值:%d",a[maxindex],a[minindex]);
}

有帮助的话麻烦采纳一下