Skip to content

Instantly share code, notes, and snippets.

@mkljczk
Last active March 24, 2017 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkljczk/c3e4ba013a14b3568f60b01595ea04cc to your computer and use it in GitHub Desktop.
Save mkljczk/c3e4ba013a14b3568f60b01595ea04cc to your computer and use it in GitHub Desktop.
#include <iostream>
bool czyPierwsza(int n)
{
for(int i=2;i<=5000;i++)
{
if(i!=n&&n%i==0) return false;
}
return true;
}
int main()
{
int input;
for(int n;n<100000&&input<=10000;n++)
{
std::cin >> input;
if(czyPierwsza(input)) std::cout << "TAK" << std::endl; else std::cout << "NIE" << std::endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment