take input two numbers n1 and n2 . print series 3n+2 having n1 terms and no term is devisible by n2 .
how to make sure output has n1 terms ??
#include
using namespace std;
int main(){
int N1 , N2 , a , n ;
cin>>N1 ;
cin>>N2 ;
n = 1 ;
while(n<=N1){
a = 3*n + 2 ;
if(a%N2 != 0){
cout<<a<<endl;
}
n = n + 1 ;
}
}