发布网友 发布时间:2024-12-13 07:12
共3个回答
热心网友 时间:2024-12-14 07:48
#include<stdio.h>
int prime(int x)
{
int i=2;
for (i=2;i<x;i++)
{
if (x%i==0)
break;
}
if (x==i)
return 1;
else
return 0;
}
void main()
{
int a,k=0;
int j;
int rst =0;
for (a=1;a<=5000;a++)
{
if(prime(a))
{
k=a;
j = k%10;
rst = prime(j);
if(rst ==0)
continue;
while(k!=0)
{
k = k/10;
rst = prime(k);
if(rst ==0)
break;
}
if(k == 0)
printf("%d ",a);
}
}
getche();
}
热心网友 时间:2024-12-14 07:52
#include<stdio.h>
int prime(int x)
{
int i=2;
for (i=2;i<x;i++)
{
if (x%i==0)
break;
}
if (x==i)
return 1;
else
return 0;
}
void main()
{
int a,k=0;
int j;
int rst =0;
for (a=1;a<=5000;a++)
{
if(prime(a))
{
k=a;
j = k%10;
rst = prime(j);
if(rst ==0)
continue;
while(k!=0)
{
k = k/10;
rst = prime(k);
if(rst ==0)
break;
}
if(k == 0)
printf("%d ",a);
}
}
getchar();
}
热心网友 时间:2024-12-14 07:57
#include<stdio.h>
int prime(int x)
{
int i=2;
for (i=2;i<x;i++)
{
if (x%i==0)
break;
}
if (x==i)
return 1;
else
return 0;
}
void main()
{
int a,k=0;
int j;
int rst =0;
for (a=1;a<=5000;a++)
{
if(prime(a))
{
k=a;
j = k%10;
rst = prime(j);
if(rst ==0)
continue;
while(k!=0)
{
k = k/10;
rst = prime(k);
if(rst ==0)
break;
}
if(k == 0)
printf("%d ",a);
}
}
getche();