#include <math.h>
#include <stdio.h>
int prime (int n)
{
int i,temp;
temp=sqrt(n);
for (i=2;i<=temp;i++)
if (n%i==0) return 0;
return 1;
}
int main()
{int num,i;
int a[20]={2,3,5,7,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73};
scanf("%d",&num);
for(i=0;i<20;i++)
if(prime(num-a[i]))
{
printf("%d = %d + %d\n",num,a[i],num-a[i]);
getch();
return 0;
}
printf("error!");
getch();
return 0;
}
a数组好象考虑多了...
大家看看~``很少做这些题,,不怕丢脸
a数组考虑少了 比如输入是503222
猝然临之而不惊,无故加之而不怒 /?spaced" target="_blank">Linux C资料