fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. // zdefiniuj funkcję
  5. bool czy_pierwsza(int n ) {
  6. int d=2;
  7. while (d*d<n) {
  8. if (n%d==0) return false;
  9. d+=1;
  10. }
  11. return true;
  12.  
  13. }
  14.  
  15. int main() {
  16. // sprawdź działanie funkcji
  17. cout << czy_pierwsza(11) <<" " << czy_pierwsza(99) << endl;
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
1 0