Inclusion Exclusion Concept + Implementation

what is the use of second for loop and how is finding the right denominators for division??

as long as I can figure out in second for loop the if condition is only executed when(i) is odd

how it’s finding the denominator explain please??

code:-https://ide.codingblocks.com/s/468564

ques:-https://online.codingblocks.com/app/player/189104/content/180080/6665/lecture

hello @dasvishal60

the outer loop generates all subsets
and for each subset the inner loop is taking multiplication of all the elements present in that subset.
and to decide what all elements are in the current subset , we are checing the set bits. the position of set bits indicates whats all elements are part of current subset.

for example->
ss

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.