#include<iostream>
using namespace std;
int main()
{
int gotbaha(int n);
int n;
cout << "请输入一个不小于6的偶数" << endl;
cin >> n;
if (n % 2 != 0)cout << "输入有误";
else
{
if (gotbaha(n) >= 1)cout << "得证";
else cout << "证伪";
}
return 0;
}
int gotbaha(int n)
{
int prime(int x);
int x = 1;
int y;
int m = 0;
for (; x <= n; x++)
{
y = n - x;
if (prime(x) + prime(y) == 2)
{
cout << x << ' ' << y << endl;
m += 1;
}
}
return m;
}
/*int prime(int x)
{
int judge;
if (x == 2)
return 1;
else {
int i;
for (i = x; (x % i != 0) && i >= 1; i--);
if (i > 1) judge = 0;
else judge = 1;
}
return judge;
}*/
int prime(int a)
{
bool n;
int i;
if (a == 2) n = 0;
else {
for (i = a / 2; a % i != 0 && i >= 1; i--);
if (i > 1) n = 1;
else n = 0;
}
return n;
}
![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/53148978163614.png "=600 #left")