Changes in code

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

@neelrai906 You are doing it wrong, take a variable count and increment it every time you get desired number and run while till count is less than n1.
If this resolves your doubt mark it as resolved.

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.