不会思路和意思,可以写下代码和注释吗,目前只学到循环和函数,没有学指针

img

它的思路和意思是什么啊?可以写一下代码和注释吗,完全超出我的能力范围内了,但是想弄懂,没有学到指针,只学到函数以及循环


#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main()
{
    srand(time(NULL)); //初始化种子
    int i, j, t;
    int a[10], cnt = 0;
    for (i = 0; i < 10; i++)
    {
        t = rand() % 100 + 1; //产生随机数,并输出
        printf("%d ", t);
        for (j = 2; j < t; j++) //判断素数
        {
            if (t % 2 == 0)
                break;
        }
        if (j == t) //如果是素数,保存到a,cnt记录素数数量
            a[cnt++] = t;
    }
    printf("\n");
    for (i = 0; i < cnt; i++) //输出素数
        printf("%d ", a[i]);
    return 0;
}