You are on page 1of 1

#include <iostream>

using namespace std;


int main()
{
int n,d,a=0;
cout<<"Enter any Number to find wether it is Prime Number or Not: ";
cin>>n;
d=n/2;
for(int i=2;i<=d;i++)
{
if(n%i==0)
a++;
}
if(a==0)
{
cout<<"Prime Number"<<endl;
}
else
cout<<"Not a Prime Number"<<endl;
return 0;
}

You might also like