Please tell me why it showing arithmatic exception THIS IS DIVISIBLE SUBARRAY PROBLEM LINK--->https://hack.codingblocks.com/app/practice/6/1065/problem

hello @kailash_01,
may in some test cases u p remains 0 and u are trying sum%0 .

btw
a)p will always be n for this problem.
b) also ur solution time complexity is O(n^3) it will give tle.

refer this video solution for this problem by prateek bhaiya,