Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Function 1:
- function baskara(a, b, c)
- {
- var x1 = (-b + Math.sqrt(Math.pow(b,2) - (4*a*c)))/(2*a);
- var x2 = (-b - Math.sqrt(Math.pow(b,2) - (4*a*c)))/(2*a);
- return "s={" + x1 + ", " + x2 + "}";
- }
- //Function 2:
- function baskara(a, b, c)
- {
- var t = new Array(2);
- t[0] = (-b + Math.sqrt(Math.pow(b,2) - (4*a*c)))/(2*a);
- t[1] = (-b - Math.sqrt(Math.pow(b,2) - (4*a*c)))/(2*a);
- return t;
- }
Advertisement
Add Comment
Please, Sign In to add comment