Not getting correct answer

in my code for the test case
5
1 2 3 4 5

the correct DP is INT_MIN, 1, 2, 3, 4 , 5, INT_MAX

by my output is INT_MIN,1, 2, 3, 4 ,0 , INT_MAX

please tell me why i am getting this and how to correct it

hi shivam,
at the time of printing in the last loop change the condition to i<=n instead of i<n.
Please Let me know if you need any other help.