View Code of Problem 92

#include<stdio.h>
#include<math.h>
int main(){ 
  int m,n,i,j,s,x,count=0,flag;
  scanf("%d%d",&m,&n);
  for(i=m;i<=n;i++){
  	s=0;
  	x=i;
  	while(x>0){
  		s=s*10+x%10;
  		x=x/10;
	  }
	if(s==i){
		flag=1;
		for(j=2;j<=sqrt(i);j++){
			if(i%j==0){
				flag=0;
				break;
			}
	    }
	    if(flag==1){
	    	count++;
	    	printf("%6d",i);
	    	if(count==4){
	    		count=0;
	    		printf("\n");
			}
		}
	    	
	}
	
  } 
	return 0;
} 

Double click to view unformatted code.


Back to problem 92