Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {==============================================================================]
- Explanation: Returns percentage of source.
- [==============================================================================}
- function PercentOf(percent, source: Extended): Extended;
- begin
- if (percent <> 0) then
- Result := ((Extended(percent) / 100) * Extended(source))
- else
- Result := 0.0;
- end;
- var
- x: Extended;
- begin
- ClearDebug;
- x := 100;
- WriteLn(FloatToStr(PercentOf(100, x)));
- x := (x + 400);
- WriteLn(FloatToStr(PercentOf(10, x)));
- WriteLn(FloatToStr(PercentOf(25, x)));
- end.
Advertisement
Add Comment
Please, Sign In to add comment