Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- bool isPrime(int number) {
- if (number <= 0 || number == 1)
- return false;
- int border = number / 2;
- for (int i = 2; i < border; i++)
- if (number % i == 0)
- return false;
- return true;
- }
- void printNum(int number, int arg, int args) {
- std::cout << "Yes!\n";
- std::cout << number << " = " << arg << " + " << args;
- }
- bool canBeRepresent(int number) {
- if (number < 4)
- return false;
- int border = number / 2;
- for (int i = 2; i < border; i++)
- if (isPrime(i) && isPrime(number - i)) {
- printNum(number, i, number - i);
- return true;
- }
- return false;
- }
- int main() {
- int arg;
- std::cin >> arg;
- if (!canBeRepresent(arg))
- std::cout << "No";
- }
Add Comment
Please, Sign In to add comment