Advertisement
Siwy_Krzysiek

Tajemnicza funkcja

Sep 28th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. bool tajemniczaFunkcja(int liczba)
  2. {
  3.     if (liczba <= 1)
  4.         return false;
  5.     if (liczba <= 3)
  6.         return true;
  7.     if (liczba%2 == 0)
  8.         return false;
  9.  
  10.     for (int i=3; i*i<=liczba; i+=2)
  11.     {
  12.         if (liczba%i == 0)
  13.             return false;
  14.     }
  15.  
  16.     return true;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement