Prime number cheker

i am write correct cod and they compile succesfully
but at submission time they say wrong answer

cod is =

#include
using namespace std;

int main(){

int n;
cin>>n;
for( int i=2; i<=n-1; i++){
if(n%i==0){
cout<<“not prime”<<endl;
break;
}
}
if(i==n){
cout<<“prime”<<endl;
}

return 0;

}

Your mistakes

  1. print “Not Prime” (N and P should be capital)
    similarly print “Prime” (P capital)

  2. declare int outside the for loop otherwise it is not available outside loop

see the correct code below

Modified Code

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.