Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- bool pierwsza(int x)
- {
- if(x<2) return false;
- for(int i=2; i <= sqrt(x); i++)
- if(x%i==0) return false;
- return true;
- }
- int main()
- {
- int n;
- cin>>n;
- for(int i = 0; i<n; i++)
- {
- int x;
- cin>>x;
- if(pierwsza(x))
- {
- cout<<"TAK\n";
- }
- else
- {
- cout<<"NIE\n";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement