#include<stdio.h> #include<math.h> int Prime(int n)//判断素数的工具(8以上有效) { for (int i = 2; i <= int(sqrt(n)); i ++) while (n% i == 0 ) return 0; return 1; } int div(int array[10], int a) { int i=0, j=0; while (a != 0) { array[i] = a % 10; a /= 10; i++; } return i; } int main() { int a; int b,k=0; int i = 0, j = 0; int Array[10] = { 0 }; p:printf("请输入一个大于10的整数(输入回文素数有奖励):\n"); scanf_s("%d",&a ); j=div(Array, a)-1; b = Prime(a); if (b == 0) goto p; for (i = j; i>= 0; i--) printf("%d", Array[i]); { printf("是%d位素数", div(Array, a)); while (i <= j) { i = 0; if (Array[i] != Array[j - i]) break; i++; printf("且是回文素数\n"); goto p; }printf("但不是回文素数\n"); } }