Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool is_current_divisor_simple(int divisor) {
- for (int i = 2; i <= sqrt(divisor); i++) {
- if (divisor % i == 0) {
- return false;
- }
- }
- }
- void task5() {
- int n;
- cin >> n;
- for (int divisor = 2; divisor < n; divisor++) {
- if (n % divisor == 0) {
- if (is_current_divisor_simple(divisor)) {
- cout << divisor << " ";
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment