Hi all, I have to create a function that will look at an array of 5 numbers and find the difference between adjacent numbers and from them differences then return the largest difference.
Honestly I'm not sure where to start I know using loops will be my best bet but I'm unsure.
Arrays
So for the first one the maximum difference would be 49 (10 to 59)
Second one the maximum difference would be 150 (-50 to 100)
Remember it has to be between numbers next to each other.
Thanks in advance!
Honestly I'm not sure where to start I know using loops will be my best bet but I'm unsure.
Arrays
Code
int [] numbers = {12, 8, 34, 10, 59};
int [] numbers2 = {-50, 100, 20, -40};So for the first one the maximum difference would be 49 (10 to 59)
Second one the maximum difference would be 150 (-50 to 100)
Remember it has to be between numbers next to each other.
Thanks in advance!


