#include
void main(){
int i,j,n;
scanf("%d",&n);
if(n%2) printf("Input error!");
else
{
for(i=2;i<=n/2;i++)
{
for(j=2;jif(i>j&&i%j==0||(n-i)%j==0)
break;
if(j==n-i)
printf("%d %d\n",i,n-i);
}
}
}
#include "stdio.h"
int prime(int n){
int i;
if(n>2 && !(n&1) || n<2)
return 0;
for(i=3;i*i<=n;i+=2)
if(!(n%i))
return 0;
return n;
}
int main(int argv,char *argc[]){
int m,n,t;
printf("Please enter a positive even number...\n");
if(scanf("%d",&m)!=1 || m<2 || m%2){
printf("Input error, exit...\n");
return 0;
}
if(m>3){
for(t=m>>1,n=2;n<=t;n>2 ? n+=2 : n++)
if(prime(n) && prime(t=m-n))
printf("%d %d\n",n,m-n);
}
else
printf("No possible...\n");
return 0;
}
运行样例: