Janilabo Posted May 22, 2012 Share Posted May 22, 2012 Percent [scar]function Percent(position, source: Extended): Extended; begin if (position = 0) then Result := 0 else Result := (100 * (position / source)); end; var i: Integer; begin ClearDebug; for i := -10 to 10 do WriteLn(IntToStr(i) + ' = ' + FloatToStr(Percent(i, 5)) + '% of 5.'); end.[/scar] Quote Link to comment Share on other sites More sharing options...
Wanted Posted July 20, 2017 Share Posted July 20, 2017 Old post but would be useful to add significant figures and/or decimal places. Quote Link to comment Share on other sites More sharing options...