H2330819027


私信TA

用户名:dotcpp0701405

访问量:8321

签 名:

指向函数指针数组的指针int(*(*p[4]))(int int)

等  级
排  名 128
经  验 7457
参赛次数 1
文章发表 79
年  龄 18
在职情况 学生
学  校 Hzu university
专  业 软件工程

  自我简介:


解题思路:

注意事项:

参考代码:

#include <stdio.h>

int su(int x)
{
    int j;
    if (x <= 1)
    {
        return 0; // 0和1不是素数
    }

    for (j = 2; j * j <= x; j++)
    {
        if (x % j == 0)
        {
            return 0; // 不是素数
        }
    }
    return 1; // 是素数
}

int wen(int x)
{
    int t, ret = 0;
    int temp = x;
    while (temp != 0)
    {
        t = temp % 10;
        ret = ret * 10 + t;
        temp /= 10;
    }

    return x == ret; // 检查是否是回文数
}

int main()
{
    int a, b, x;
    scanf("%d%d", &a, &b);
    for (x = a; x <= b; x++)
    {
        if (su(x) == 1 && wen(x) == 1)
        {
            printf("%d\n", x);
        }
    }
    return 0;
}


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区