c++ check prime
#include <bits/stdc++.h>
using namespace std;
int main()
{
int prime;
cin >> prime; // input should be greater then 0
bool is_prime = true;
for (int i = 2; i * i <= prime; i++)
{
if (prime % i == 0)
{
is_prime = false;
break;
}
}
if (is_prime)
{
cout << "Prime number" << endl;
}
else
{
cout << "Not Prime number" << endl;
}
return 0;
}