Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Project5433;
- uses
- System.SysUtils;
- const
- eps = 0.01;
- var
- root:integer;
- initialValue,squareRoot:real;
- isCorrect:Boolean;
- begin
- isCorrect := false;
- repeat
- writeln('Введите натуральное число ');
- try
- readln(root);
- if ( root < 2147483647) and (root > 0) then
- isCorrect := true
- except
- writeln('Введены некоректные данные! Повторите!');
- end;
- until isCorrect;
- squareRoot := 1;
- repeat
- begin
- initialValue := squareRoot;
- squareRoot := (initialValue + root/initialValue)/2;
- end;
- until (abs(squareRoot - initialValue) < eps);
- writeln ('Итог ' , squareRoot:7:3);
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement