A number (N1)
A number (N2)
Write a function which prints first N1 terms of the series 3n + 2 which are not multiples of N2.
Am not getting how to approach this question
@itsmazhar7,
For the input:
3
2
Then we need to print first 3 terms starting from n = 1 in the given series (3n + 2) which are not divisible by 2.
In that case nums starting from n = 1 are 5, 8, 11, 14, 17, 23… and so on. but we need to print only those numbers which are not divisible by 2, which are, 5, 11, 17.
- The problem most of the students will face is
“how to print first N1 terms?”
“What should be the condition to end the loop?” as the N1 terms are not defined. - Ans is simple we will use a counter variable and initialize it with 0 and will increment it only when we got the number in the series which is not divisible by N2 till the counter is smaller than N1.
1 Like
ok i will try ans let u know
can u give me ur mail id
ok sir i will try…
1 Like
yes give it some try
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.