Janilabo

Janilabo | Fraction() [SCAR Divi]

May 8th, 2013
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.60 KB | None | 0 0
  1. {==============================================================================]  
  2.   Explanation: Returns fraction of position into source.                      
  3. [==============================================================================}
  4. function Fraction(position, source: Extended): Extended;
  5. begin
  6.   if (position <> 0) then
  7.     Result := (position / source)
  8.   else
  9.     Result := 0.0;
  10. end;
  11.  
  12. var
  13.   x: Extended;
  14.  
  15. begin
  16.   ClearDebug;
  17.   x := 100;
  18.   WriteLn(FloatToStr(Fraction(50, x)));
  19.   x := (x + 400);
  20.   WriteLn(FloatToStr(Fraction(250, x)));
  21.   WriteLn(FloatToStr(Fraction(100, x)));
  22. end.
Advertisement
Add Comment
Please, Sign In to add comment