Error in compilation

Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: -2146737495
at Main.main(Main.java:15)

Why this error is occurring ?

@adityakumarsingh226,
I have corrected the run time error.
i*i<p.length instead of i<p.length.

https://ide.codingblocks.com/s/242207 corrected code.

This code will still give you a wrong answer. Please find your mistake while calculating csum.

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.