#include
#include<stdio.h>
#include<math.h>
using namespace std;
#define TRUE 1
#define FALSE 0
int main() {
int n; int boolean , i , j , temp ,temp1;
scanf("%d",&n);
for( i = n ; i<= 1000000 ; i++)
{
boolean = TRUE;
temp1 = i ;
while( temp1 != 0 )
{
temp = temp*10 + temp1 % 10;
temp1 /=10;
}
if( i!= temp)
boolean = FALSE;
if(boolean == TRUE)
{
for( j=2 ; j <= sqrt(i) ; j++)
{
if( i % j == 0)
{
boolean = FALSE;
break;
}
}
}
if(boolean == TRUE)
{
printf ("%d",i);
break;
}
}
return 0;
}
i did the same thing as http://www.codechef.com/viewsolution/5994554 solution but mine code is not getting accpted why???