Why it is not working?

Hi @aryangrover,
for(int i=0;i<=d;i++){
sum=sum+arr[i];
}
in dis use i<d. ur code will work.
Hope dis resolves ur doubt

Sir One More doubt, There it is showing that it will first pass the test cases and then user will give the proper input for that. What can I do in multiple test cases?

Hi @aryangrover,
sorry for late reply. for multiple test cases, u can declare an integer t. cin>>t (this will input number of testcases) and then put ur current code inside int main in a while(t–) loop.
u can refer to dis . I have updated ur code.


Hope dis resolves ur doubt.

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.