|
本帖最后由 zhuzhu81998 于 2015-9-1 10:49 编辑
[mw_shl_code=c,true]#include <stdlib.h>
#include <math.h>#include "stdafx.h"
#include <stdio.h>
int isPrime(int x);
int main()
{
int k,a;
for (k = 4; k <= 100;k+= 2)
{
for (a = 2; a <= sqrt(k); a++)
if (isPrime(a) && isPrime(k - a))
printf("%d=%d+%d\t", k, a, k - a);
}
system("pause");
return 0;
}
int isPrime(int x)
{
int i;
for (i = 2; i <= sqrt(x);i++)
if (x%i == 0)
{
return 0;
break;
}
else
return 1;
}[/mw_shl_code]
|
|