Why am i not getting any output?
You missed to update sum inside the while loop.
So after line 19, add this statement
sum=a[start]+a[end];
You missed to update sum inside the while loop.
So after line 19, add this statement
sum=a[start]+a[end];