Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.01 KB | None | 0 0
  1. program Lab3V1;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. {$R *.res}
  6.  
  7. uses
  8.   System.SysUtils;
  9.  
  10. var a, b, c, d, e, y,  max, error : real;
  11. x1, x2: integer;
  12.  
  13. function value (a, b, c, d, e: real; x1, x2: integer):real;
  14.     var i : integer;
  15.     begin
  16.         for i := x1 to x2 do
  17.             begin
  18.                 y :=  (a*i*i + b*i + c)/(d*i + e);
  19.                 if max < y then max := y;
  20.             end;
  21.         value := max ;
  22.     end;
  23.  
  24. begin
  25.     repeat
  26.         try
  27.             writeln ('Введите a');
  28.             readln (a);
  29.             writeln ('Введите b');
  30.             readln (b);
  31.             writeln ('Введите c');
  32.             readln (c);
  33.             writeln ('Введите d');
  34.             readln (d);
  35.             writeln ('Введите e');
  36.             readln (e);
  37.             writeln ('Введите x1');
  38.             readln (x1);
  39.             writeln ('Введите x2');
  40.             readln (x2);
  41.             error := 0;
  42.         except
  43.             writeln ('Можно вводить только числа, повторите попытку');
  44.             error := 1;
  45.  
  46.         end;
  47.  
  48.     until error = 0;
  49.     writeln (value (a, b, c, d, e, x1, x2):3:2);
  50.     readln;
  51. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement