i passed all the test cases but i feel the logic is not the best here. can somone please improve this code?
#include
using namespace std;
int main()
{
int n1,n2;
cin>>n1>>n2;
for(int i=1;i<=n1;i++)
{
int sum=0;
sum=(3*i)+2;
if(sum%n2!=0)
{
cout<<sum<<endl;
}
else
{
n1++;
}
}
return 0;
}