Advertisement
fooker

Is prime

Nov 24th, 2022
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. #define ll long long
  4. void Isprime(ll x){
  5.     int e=0;
  6.     if (x%2==0){
  7.         cout<<"Is not Prime";
  8.     }
  9.     else {
  10.         for (int i=3; i*i<=x; i++){
  11.             if (x%i==0) e=1;
  12.         }
  13.         if (e==0) cout<<"Is Prime";
  14.         else {
  15.             cout<<"Is not Prime";
  16.         }
  17.     }
  18. }
  19. int main()
  20. {
  21.     ll n;
  22.     cin>>n;
  23.     Isprime(n);
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement