View Code of Problem 92

#include<string.h>
#include<stdio.h>
int main(){
	int i,j,k=0,n,m;
	int flag,b;
	int s;
	scanf("%d %d",&m,&n);
	for(i=m;i<=n;i++){
		s=i;
		
		int sum=0;
		while(s>0){
			sum=s%10+sum*10;
			s=s/10;
			
		}
		if(sum==i){
			flag=1;
			for(j=2;j<i;j++){
				if(sum%j==0){
					flag=0;
					break;
				}
			}
			if(flag==1){
				printf("%6d",i);
			
				k++;
				if(k%5==0){
					printf("\n");
				}
			}
			
		
			
		}
	}
	
	
} 

Double click to view unformatted code.


Back to problem 92