Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const nr1 = prompt ("Podaj pierwszą wartość");
- const nr2 = prompt ("Podaj drugą wartość");
- const nr3 = prompt ("Podaj trzecią wartość");
- if (nr1 > 0 && nr2 > 0 && nr3 > 0)
- {
- let delta;
- delta = +nr2 * +nr2 - 4 * +nr1 * +nr3;
- if (delta > 0)
- {
- let x1; let x2;
- x1 = -nr2 + delta / 2 * +nr1;
- x2 = -nr2 - delta / 2 * +nr1;
- document.write ("X1 wynosi " + x1 + " a x2 wynosi " + x2);
- }
- if (delta < 0)
- {
- document.write ("Delta jest mniejsza od 0");
- }
- if (delta == 0)
- {
- let x0;
- x0 = -nr2 / 2 * +nr2;
- document.write ("Delta wynosi 0 a x0 jest równy " + x0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement