fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. bool prime(int num) {
  6. for (int i = 2; i <= sqrt(num); i++) {
  7. if (num % i == 0) return false;
  8. }
  9.  
  10. return true;
  11. }
  12.  
  13. int main() {
  14. ios::sync_with_stdio(false);
  15. cin.tie(0);
  16.  
  17. int n;
  18. cin >> n;
  19.  
  20. for (int i = 3; i < n / 2; i++) {
  21. if (prime(i) && prime(n - i)) {
  22. cout << i << " " << n - i;
  23. break;
  24. }
  25. }
  26.  
  27. return 0;
  28. }
Success #stdin #stdout 0.01s 5320KB
stdin
6
stdout
Standard output is empty