I'm getting numbers like 9 and 15 also prime by using this code . pls find the error in the code and if possible Pls edit my code to find the error Here is the code--
`#include<iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter the number : ";
cin>>n;
int flag=0;
//to check prime check from 2 to n
for(int i=2;i<=n;i++)
{
if(n%2==0)
{
cout<<n<<" is a non-prime number";
flag++;
break;
}
else
{
if(flag==0)
{
cout<<n<<" is a prime number";
break;
}
}
}
return 0;
}