prime numbers

[ad_1]

what are prime numbers
Prime numbers: whole numbers greater than 1 that are only divisible
by 1 and itself.
prime numbers
#include 
#include 
#include 

#define el "\n"

using namespace std;

bool isprime(int n)
{
    if (n <= 1)
    {
        return 0;
    }

    for(int i=2 ; i <= sqrt(n); i++) // [sqrt(n)] is faster in calculations than [n/2]
    {
        if(
        {
            return 0;
        }
    }
    return 1;
};

int main()
{
    long long num;

    cin >> num; // ~~~ Enter a number

    (isprime(num))? cout << "The number (" << num <<") is a prime" << el : cout << "The number (" << num <<") isn't a prime" << el;

    return 0;
}
prime number
def is_prime(n):
  if(n<0):
    print("n is not a nature number!")
    return False
  for i in range(1,ceil(n/2)+1):
    if (i != n and i != 1 and 
      return False
  return True
print(is_prime(int(input("number>>"))))
prime numbers
A number only divisible by 1 and itself

[ad_2]

Please follow and like us:
Content Protection by DMCA.com