Doubt in my code

Here is my code. Now, I am giving the input N1 as 10 and N2 as 4 it is only printing 7 lines. Now, also know the problem why it is happening. Because I am executing the loop N1 times and out of which all the numbers which are multiple of N2 will get removed. But I want to print N1 numbers. What is the solution to my problem?

hello @yashsharma4304
why u r using for loop?
we dont know na ,after how many iteration we will get N1 terms of required series.

use while loop and keep a counter of number of term printed so far ,break the loop we N1 terms are printed

Ok so now also it is not working. What is the problem in it?

check now->

1 Like

Ok now I understand that whenever the continue statement executes it skips all the statement below it and due to which the value of n will not be updated in that case and the if statement will execute again and again. Thank you for guiding me. :grinning: