pls tell me what is wrong in code it is giving runtime error (apart from declaring long long int) link to code is https://ide.codingblocks.com/s/119529
Histogram run time erroe
@Tanna You were not printing the final result. Even after that your code is not giving run time error. It is giving wrong answer. Also use long long int and then recheck your logic.
Consider the case:
4
4 3 2 1
Expected Output:
6
Your Output:
16
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.