The number of language job number [C] palindromic primes

Analyzing less than any one of 11 to both prime integer between 11 and 1000 is greater than the number of palindromic integer number.

Palindrome that is symmetrical about the number, such as: 292,333,123321.

#include<stdio.h>
#include<math.h>
int sushu(int m)
{
int k=(int)sqrt(m);
int i;
for(i=2;i<=k;i++)
if(m%i==0)
{
return 0;
break;
}
return 1;
}
int main()
{
int a,i,count;
while(scanf("%d",&a)!=EOF)
{
count=0;
for(i=11;i<=a;i++)
{
if(sushu(i)==1)
{
if(i<100&&i/10==i%10)
{
count++;
}
else if(i>100&&i/100==i%10)
{
count++;
}
}
}
printf("%d\n",count);
}
return 0;
}

[Their answers, the teacher's answer after the paste out. ]

Guess you like

Origin www.cnblogs.com/asher0608/p/11689509.html