Related tom print series

sir it is showing timelimit error i dont why plz make it clear.
my code
#include
using namespace std;
int main() {
int n1,n2;
cin>>n1;
cin>>n2;
int p=1,n=1;
while(p<=n1){
if((3n+2)%n2==0){
continue;
}
else{
cout<<3
n+2<<endl;
n++;
p++;
}
}
return 0;
}

share code in cb ide

if n2=5 and n1=3,
then while loop will continue infinitely
please check that p++ and n++ are inside the else {}
I think there should be atleast one update (p++ or n++ or both) in if{}container then continue;

share the problem statement and constraints given if you are not getting!!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.