You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
389 B
27 lines
389 B
#include<bits/stdc++.h>
|
|
using namespace std;
|
|
#define MAX 1000
|
|
int is_sushu(int n) {
|
|
int i, mid;
|
|
mid=(int)sqrt(n);
|
|
for(i=2; i<=mid; i++)
|
|
if(0 == n%i)
|
|
return 0;
|
|
return 1;
|
|
}
|
|
int main() {
|
|
int i, mid, n;
|
|
|
|
printf("Enter an even num: ");
|
|
scanf("%d", &n);
|
|
|
|
mid=n/2;
|
|
for(i=2; i<=mid; i++) {
|
|
if(is_sushu(i) && is_sushu(n-i))
|
|
printf("%d = %d + %d\n", n, i, n-i);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|