FACTO SUM in array1.0

https://ide.codingblocks.com/#/s/30157

test cases failed

https://ide.codingblocks.com/#/s/30161
check the comments in the above code^
Hope it helps

it didnt work either
test cases 2,3 and 6 ares till not passed
moreover i didnt understand why (fact*i)%m is required

https://ide.codingblocks.com/#/s/30642

Try submitting this. (fact*i)%m is required, that means we require to take mod at each stage because if we are finding factorial of large numbers like 30!, then it can not be stored in an integer. So taking mod at each stage works correctly.

i got it but still its not working those three test cases are still displaying not passed
i even tried declaring fact variable in factorial function with long int still those cases are not working

https://ide.codingblocks.com/#/s/30699

https://ide.codingblocks.com/#/s/30723

See this, i have marked the change. It passes all cases now.
Please add the problem link from next time for fast replies.

ok,i will surely add problem link from next time onwards
thankyou

1 Like