Submission #5303975 (print series problem) why is it printing wrong seroes

#include

using namespace std;

int main()
{
int i{1},k{1},n1{0},n2{0};
cin>>n1>>n2;
while(i<=n1){

    if(((3*k)+2) % n2 ==! 0)
    {


        cout<<((3*k)+2)<<endl;
        i++;
        k++;


    }
else{
        k++;
    }
           }

}

@Shubham_helloworld WWhy are you using double equals : if(((3*k)+2) % n2 ==! 0) . Use single != for comparision

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.