Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program mdp;
- {$mode objfpc}{$H+}
- uses crt,FileUtil;
- function f(x:real):real;
- begin
- f:=x-2+(sin(1/x));
- end;
- var a, b, c, e, x:real;
- begin
- writeln (UTF8toConsole('Введiть A'));
- readln (a);
- writeln (UTF8toConsole('Введiть B'));
- readln (b);
- writeln (UTF8toConsole('Введiть E'));
- readln (e);
- c:=(a+b)/2;
- while abs(a-b)>e do
- begin
- if f(a)*f(c)<0 then b:=c
- else a:=c;
- c:=(a+b)/2;
- end;
- x:=(a+b)/2;
- writeln ('x = ', x:3:4,' f(x)=',f(x):3:3);
- readkey;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement