What is the error in this code...!

https://ide.codingblocks.com/s/188729

@sonu28sharma99 Your logic is going wrong in the loop. Dry run with any case and check it.
Loop should be something like this:
while(i<=n1)
{
if((3 * n+2)%n2!=0)
{
cout<<(3* n)+2<<endl;
i++;
}
n++;
}

You can also refer this Print series problem