Largest Adjacent Sum of integers

Closed
jpatl Posts 1 Registration date Saturday 15 September 2012 Status Member Last seen 15 September 2012 - 15 Sep 2012 à 10:50
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 - 16 Sep 2012 à 11:48
Hello,

how to return the largest adjacent sum of an array of integers?
example : int a[]={1,2,4,5};
return 9 because 1+2=3 and 4+5=9
9>5....
can anybody help me with this?
thank you



1 response

rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 766
16 Sep 2012 à 11:48
I think, you would have to add then have to make which is the max number. I dont believe there is any inbuild functionality than can do it