Code Link->https://ide.codingblocks.com/s/218595
here is code can you help me where I am doing wrong
TestCase Failed in Playing With Divisors and fun
@imsaurabh take modulo properly.
(result * ((i * half + 1)%mod) ) % mod;
If this resolves your doubt mark it as resolved.
@imsaurabh one more thing, instead of half, use prod directly, prod can be odd, but (i*prod) will always be even.
(result * (((i * prod)/2+ 1)%mod) ) % mod;
If this resolves your doubt mark it as resolved.
@Abhinav2604 After taking properly modulo answer was not accepted yet
Code Link-> https://ide.codingblocks.com/s/220123
@imsaurabh Hey we cannot take modulo in division. To take modulo with two take the multiplicative inverse of 2 and then multiply that inverse with the i*prod and take modulo
(p/q)%m= p*(Inv(q))%m
Sorry for the late reply, i forgot about your doubt.
If this resolves your doubt mark it as resolved.