#include
using namespace std;
int main()
{
int ans,n,n1,n2;
cin>>n1>>n2;
for(int i=1; i<=n1; i++)
{
ans=(3*n1)+2;
if(ans%n2!=0)
{
cout<<ans<<endl;
}
else
continue;
}
return 0;
}
why don’t I get any output??
#include
using namespace std;
int main()
{
int ans,n,n1,n2;
cin>>n1>>n2;
for(int i=1; i<=n1; i++)
{
ans=(3*n1)+2;
if(ans%n2!=0)
{
cout<<ans<<endl;
}
else
continue;
}
return 0;
}
why don’t I get any output??
Hi,
You should get output, but you get wrong answer. You should start with n=1(in equation 3n+2) and print n1 integers which are not divisible by n2.
I have corrected your code:https://ide.codingblocks.com/s/184519
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.