SHARE
TWEET

Untitled

a guest Sep 17th, 2019 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. unit Unit1;
  2.  
  3. interface
  4. uses Math;
  5.   type
  6.   TFunc = function(Arg : real): real;
  7.   procedure rightrec(strt, stp, h: real; undint: TFunc);
  8.   function T(Arg: real): real;
  9.   var F: TextFile;
  10. implementation
  11.   var integral, strt, stp, h: real;
  12.       dirOut: string;
  13.       undint: TFunc;
  14.   function T;
  15.   begin
  16.     result := 1/(Arg + 1);
  17.   end;
  18.   procedure rightrec;
  19.   var t: real;
  20.       n, i: integer;
  21.   begin
  22.     n := Round((stp - strt)/h);
  23.     integral := 0;
  24.     for i := 0 to (n-1) do begin
  25.       t := strt + (i + 1)*h;
  26.       integral := integral + h*undint(t);
  27.     end;
  28.   end;
  29. begin
  30.   readln(strt, stp, h);
  31.   dirOut := 'C:\Users\Lenovo\Desktop\out.txt';
  32.   AssignFile(F, dirOut);
  33.   rewrite(F);
  34.   rightrec(strt, stp, h, T);
  35.   writeln(F, integral:4:4);
  36.   CloseFile(F);
  37. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top