Hong-Phuc Bui
2025-10-17 85e9b6730a1c181d3c0d4a1a11ea3648dfac717c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * quadratic-equation.js
 *
 */
 
import {terminal} from "./dfhi.js";
 
window.main = (...argv) => {
    const a = Number(argv[0]),
          b = Number(argv[1]),
          c = Number(argv[2]);
    const delta = b*b - 4*a*c;
    const d = Math.sqrt(delta);
    const x1 = (-b + d) / (2*a),
          x2 = (-b - d) / (2*a);
    
    terminal.printl(`Equation: ${a}x^2 + (${b})x + (${c})`);
    terminal.printl(`first solution: ${x1}`);
    terminal.printl(`second solution: ${x2}`);
};