Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- bool czy_pierwsza(unsigned x)
- {
- if(x == 1)
- return false;
- if(x == 2)
- return true;
- for(unsigned i = 2; i <= pow(x,0.5); ++i)
- {
- if(x % i == 0)
- return false;
- }
- return true;
- }
- int main()
- {
- cout << czy_pierwsza(170) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment