Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <script>
- var pierwiastek = parseInt(prompt("Podaj liczbe z ktorej chcesz wyliczyc pierwiastek: "));
- var dokladnosc = parseFloat(prompt("Podaj dokladnosc: "));
- var x = 1;
- while(Math.abs(x-((x+(pierwiastek/x))/2))>dokladnosc)
- {
- x = ((x+(pierwiastek/x))/2);
- }
- document.write("Pierwiastek wynosi: ", x);
- </script>
- </head>
- <body>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement