I am not getting the idea how to solve this problem. The problem is to print the N1 terms of the series (3n+2) which are not multiples of N2
Print series problem
@ankita_10 Follow this algo and code it yourself. Consider any sample case and dry run with the following algo. This will help you understand.
thank you for the solution
@ankita_10 basically i will take example to make you understand this problem 2m ✓
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.
so ans will be 5 11 17
We can apply simple brute force here and take a counter variable initialise with 0 so that when it raechesn1 we can stop as we have to print n1 terms only and put values of n starting from n=1 in 3n+2 and than check for divisiblity with 2 and if divisible print it just now
Hope you understand
it is not showing the output
I mean the output screen is not available for the custom input. It is just showing that the compilation is successful.
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.