Implementation depends on the language, but in general you just save the maximum value.
Do a comparison of new values against the old maximum value (start w/ a maximum of zero), if the new value is greater, then it becomes the maximum value.
Here's a generic LabVIEW example (replace the dice with the analog input).
