Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
Janilabo

Percent

Recommended Posts

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]

Share this post


Link to post
Share on other sites

Old post but would be useful to add significant figures and/or decimal places.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×