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 0;
  9. d += 1;
  10. }
  11. return 1;
  12. }
  13.  
  14. int main() {
  15. // sprawdź działanie funkcji
  16. cout << czy_pierwsza(11) << "" << czy_pierwsza(99) << endl;
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
10