#include
using namespace std;
int main(){
int n;
cin>>n;
int i;
for(i=2;i<=n-1;i++){
if(n%i==0){
cout<<"Not a prime "<<endl;
break;
}
}
if(i==n){
cout<<"Prime number "<<endl;
}
return 0;
}
#include
using namespace std;
int main(){
int n;
cin>>n;
int i;
for(i=2;i<=n-1;i++){
if(n%i==0){
cout<<"Not a prime "<<endl;
break;
}
}
if(i==n){
cout<<"Prime number "<<endl;
}
return 0;
}
ur cout statements were not matching with what is given in question. I have corrected ur code… its passing all test cases now
Thank you. For clearing the doubt
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.