Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- </head>
- <body>
- <input type+"text" id="a"> <button type="button" id="button">ok!</button>
- <div id="tekst"></div>
- <script type="text/javascript">
- document.getElementById('"button"').onClick;
- const p = 6;
- const e=0.0001;
- var x;
- var a = document.getElementById('"a"').value;
- if (a<0)
- {
- document.getElementById("tekst").html("Podaj a większe od zera");
- }
- else
- {
- do
- {
- x=p;
- p=(x+a/x)/2;
- }
- while (abs(p-x)>e;
- }
- document.writeln('Pierwiastkiem jest: ' +p);
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement