Facto sum failing in 5th test case

please tell what are the mistakes in this code since in fifth test case it is giving run-error
https://ide.codingblocks.com/#/s/22291

Please post link to the problem statement also.