Sir plz check my code whether it is correct or not

code name :- To Check number is prime number or not, or sir give me another code to check the number is prime number or not.

CODE :-
#include
using namespace std;
int main()
{
int a,n,i=2;
cout<<“Enter the number”<<endl;
cin>>n;
for(int i=2;i<n;i++)
{
if(n%i==0)
{

           i++;

    }
}
if(n%i==0){
cout<<"The number is not prime";
}
else cout<<"The numer is prime number";

 return 0;

}

Hey, instead of printing the statments inside for loop, you can use a flag to check if it’s prime or not and accordingly print the result outside the for loop.

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.