Program error could anyone tell me why its printing repeatedly one answer whre i id wrong?

#include
using namespace std ;
int main()
{
int i,n;
cout<<“Enter any number:”;
cin>>n;
i = 2;
while(i<=n)
{
if(n%i==0)
cout<<n<<“is prime number”;
else
cout<<n<<“is not a prime number”;
i++;
}
return 0;
}

hello @farid.chorshanbiev
your logic is incorrect.

A number n is said to be prime number ,if it is only divisible by 1 and n.

run a loop from i=2 to i=n-1 .
and if for any value of i , n%i==0 then it is not prime ,otherwise it is prime