Why my code getting timeout

#include
using namespace std;
int main() {
int n1,n2,i=1;
cin>>n1>>n2;
while(i<=10)
{
if((3i+2)%n2!=0)
{
cout<<(3
i)+2<<endl;
i++;
}
}
return 0;
}

@aviral989 Your logic was wrong. Dry run your own code with the sample case and check how it was wrong.
However i have made some changes. Check the code: