View Code of Problem 92

#include<stdio.h>
int main(){
	int m,n;
	int i,j,s,a;
	int isprime;
	int num=0;
	scanf("%d %d",&m,&n);
	for(i=m;i<=n;i++){
		s=i;
		a=0;//每一个i都要对其初始化
		while(s>0){
			a=a*10+s%10;
			s=s/10;
		} 
		if(a==i){//这里表示已经是回文素了 
			isprime=1;
			for(j=2;j<a;j++){
				if(a%j==0){
					isprime=0;
					break; 
				} 
			} 	
			if(isprime==1){
				num++;
				printf("%6d",i);
				if(num%5==0){
					printf("\n");
				}
			}
			}
		
		
		
	} 
 
	return 0;
}

Double click to view unformatted code.


Back to problem 92