Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Zadanie 21

JakubJaneczek Apr 7th, 2020 150 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. using namespace std;
  3. int n;
  4.  
  5. int liczba_pierwsza(int n){
  6.     if(n<2)
  7.         return 0;
  8.     for(int i=2; i*i<=n; i++)
  9.         if(n%i==0)
  10.             return 0;
  11.     return 1;
  12. }
  13.  
  14. int main()
  15. {
  16.     cout << "Podaj liczbe: ";
  17.     cin >> n;
  18.     if(liczba_pierwsza(n)==1){
  19.         cout << "Liczba jest pierwsza" << endl;
  20.     }
  21.     else{
  22.         cout << "Liczba nie jest pierwsza" << endl;
  23.     }
  24.  
  25.     return 0;
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top