Check prime number

i have written code correctly but my all test case failed dont know why please look into this also writting my code down

#include
using namespace std;
int main() {
long n;
cin>>n;
if(n>0){
for(int i = 2; i<n; i++){
if(n%i == 0){
cout<<“Not Prime”;
}
else{
cout<<“Prime”;
}
}}
else if(n<0){
for(int i = 0; i<n; i–){
if(n%i == 0){
cout<<“Not Prime”;
}
else{
cout<<“Prime”;
}
}
}
return 0;
}

Hi @sahilkumar23102003_bbf6ee38349d98a1,

There is no need to check for n<0, as it is given that n will always be greater than 2.

Refer to this: https://ide.codingblocks.com/s/655234

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.