How can I take a value and a known maximum and change it to a percent for a gauge.

How can I take a value and a known maximum and change it to a percent for a gauge.

I need to take an input value from a sensor knowing that 5 is the maximum value or 100%. That gauge will display the percentage not the actual sensor value.