<!DOCTYPE html> <html> <body> <script> function liniowe(a,b) { if (a==0) if (b==0) alert("Równanie tożsamościowe"); else alert("Równanie sprzeczne"); else { var x = -b / a; alert("x = " + x); } } var a=prompt("a:", ""); var b=prompt("b:", ""); var c=prompt("c:", ""); if (a == 0) liniowe(b,c); else { var delta = b*b-4*a*c; if (delta < 0) alert("Brak roziązań"); else if (delta == 0) { var x = -b / (2 * a); alert("Jedno rozwiązanie x = " + x); } else { var x1 = (-b + Math.sqrt(delta)) / (2 * a); var x2 = (-b - Math.sqrt(delta)) / (2 * a); alert("x1 = " + x1 + " x2 = " + x2); } } </script> </body> </html>
- Algorithm of division in JavaScript
- Implementation of a Linear equation solving algorithm in JavaScript
- Implementation of the algorithm solving a quadratic equation in JavaScript
- Factorial in JavaScript - iteratively
- Factorial in JavaScript - recursive
- Monte Carlo Calculation of pi in JavaScript
- Sito Eratostenesa w JavaScript