Regarding print series

sir I am getting an infinite loop with my code .where is the problem
#include
using namespace std;
int main()
{
int n1,n2;
cin>>n1;
cin>>n2;

for(int i=1;i<=n1;i++)
{
	i=3*i+2;
	while(i%n2!=0)
	{
		cout<<i<<endl;
	}
}
return 0;

}

Hey @Megha2468
See this code : https://ide.codingblocks.com/s/185367

If your doubt is resolved please mark it as closed.

sir the code is showing tle erro

Hey @Megha2468
I submitted my code and it passed all test cases. Please check your code with it again.