#include
using namespace std;
int main()
{
int N1, N2;
cin>>N1;
cin>>N2;
int i=1;
while(i<=N1)
{
int num = (3*i)+2;
if((num%N2)!=0)
{
cout<<num<<endl;
i++;
}
}
return 0;
}
Print series: getting TLE
@sakshi.saxena i have to be incremented every time
corrected
i hope it clear if yes dont forget to hit like and mark resolved 
whats the use of kk here?Can you please help it out with a for loop instead?
@sakshi.saxena you were using i inside it right just took a different variable kk as i needs to be incremented outside the if
1 Like
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.