Created
October 22, 2016 02:14
-
-
Save jromeem/67f48103ddbec50ffae8f0daaa06da81 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int[] numbers = {1,2,3,6,1,6,48,38,77,23}; | |
void setup() { | |
int x = findMaximum(numbers); | |
println(x); | |
} | |
int findMaximum(int[] someNumbers) { | |
int currentMax = someNumbers[0]; | |
for(int i=0; i<someNumbers.length; i++) { | |
int thisNumber = someNumbers[i]; | |
if (thisNumber > currentMax) { | |
currentMax = thisNumber; | |
} | |
} | |
return currentMax; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment