Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool is_simple(int a) // простое ли число
- {
- bool t = true;
- if (a != 1)
- for (int i = 2; i < sqrt(a); i++)
- t &= !(a % i);
- else
- t = false;
- return t;
- }
- bool is_simple_el(int* a, int n) // есть ли в массиве простой элемент
- {
- bool t = false;
- for (int i = 0; i < n; i++)
- t |= is_simple(a[i]);
- return t;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement