Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static bool isprime(int szam)
- {
- int count = 0;
- if (szam < 0)
- {
- szam = -szam;
- }
- if (szam < 2)
- {
- return false;
- }
- else if (szam == 2)
- {
- return true;
- }
- else
- {
- for (int i = 2; i < szam; i++)
- {
- if (szam % i != 0)
- {
- count++;
- }
- }
- if (count == szam - 2)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement