Advertisement
caeles-lupus

q201764889

Jul 4th, 2017
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.60 KB | None | 0 0
  1. function Y(x:integer;var err:boolean):real;
  2. begin
  3. err:=false;
  4. if x in [1,3,5,7] then Y := sqr(x+cos(x))
  5.   else if x in [2,4,6,8] then
  6.   begin
  7.     if (sin(x)/5>=0) then Y := sqrt(sin(x)/5)
  8.     else err:=true
  9.   end
  10.     else
  11.     begin
  12.       if ((x+2)>0) then Y := x+ln(x+2)
  13.       else err:=true;
  14.     end;
  15. end;
  16.  
  17. var x,a,b:integer; rr:boolean; Yx:real;
  18. BEGIN
  19.   write('a=');readln(a);
  20.   write('b=');readln(b);
  21.   for x := a to b do
  22.   begin
  23.     Yx:=Y(x,rr);
  24.     write('Y(',x,')=');
  25.     if not(rr) then writeln(Yx:0:3)
  26.     else writeln('Невозможно вычислить!');
  27.   end;
  28. END.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement