int main(int argc,char *argv[]){
int n,i,j
printf("Please enter a positive integer...\n"宽蚂)
scanf("衡巧轮%d",&n)
for(i=n,j=0i(j*=10)+=i%10,i/=10)
printf(j==n 咐信? "Yes\n" : "No\n")
return 0
}
运行样例:
#include<stdio.h>乱凳int 宏扰main()
{
int a,m
int s = 哗绝旅0
scanf("%d",&a)
m = a
while(m!=0)
{
s = s*10+m%10
m=m/10
}
if(s == a)
printf("yes\n")
else
printf("no\n")
return 0
}
static void isPrime(int start, int a[], int len){
int k = start, num = a[start]
for (int i = k i <团码 弯搭len i++)
{
if 埋或拿(i%num != 0) a[k++] = a[i]
}
if (num < len)isPrime(start + 1, a, k)
}
int main()
{
int len = 100,kinds=0,a[100]
int n=20,m=1
cin>> m >> n
for (int i = 1 i < len i++) a[i] = 2 * i - 1
isPrime(2, a, len)
for (int i = 1 i<len i++)
{
if (a[i]>m && a[i] < n) kinds++
if (a[i] >= n) break
}
cout << kinds << endl
return 0
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)