#include
using namespace std;
int main() {
int n;
cin >> n;
int flag=0;
for(int i=2;i<n/2;i++){
if(n%i==0){
flag=1;
}
else{
flag=0;
}
}
if(flag==1){
cout<<“Prime”;
}
else{
cout<<“Not Prime”;
}
return 0;
}
I think my logic is correct but test cases are not satisfied
Check for n=3. Your code will give “Not Prime”. Check for these cases and try to correct.
If you are not able to correct then save your code on ide.codingblocks.com and share its link.
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.