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

int main() { int arr[20]; int i; int j = 0; int m = 1;

srand((unsigned int)time(NULL));

for (i = 0; i < 20; i++)
{
    arr[i] = i + 1;
}

while (j != 19)
{
    if (arr[j] != 0)
    {
        m++;
        if (m == 4)
        {
            arr[j] = 0;
            m = 1;
        }
    }
    j++;
    j %= 20;
}

for (i = 0; i < 20; i++)
{
    if (arr[i] != 0)
        printf("%d\n", arr[i]);
}

return 0;

}


原文地址: https://www.cveoy.top/t/topic/loua 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录