Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- var a, b, c, x1, x2;
- a = parseFloat(window.prompt("enter a"));
- b = parseFloat(window.prompt("enter b"));
- c = parseFloat(window.prompt("enter c"));
- x1 = (((-1)*(b)) + (Math.sqrt(Math.pow(b,2)) - ((4) * (a) * (c)))) / (2*(a))
- x2 = (((-1)*(b)) - (Math.sqrt(Math.pow(b,2)) - ((4) * (a) * (c)))) / (2*(a))
- if (a == 0 ) document.write("error! a cannot be 0!");
- else document.write("x1 = " + x1 + <br /> + "x2 = " + x2);
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement