{"size": 671, "ext": "js", "max_stars_repo_path": "L03. Exercise - Syntax, Operators and Logic Flow/19. Quadratic Equation.js", "max_stars_repo_name": "tchenkov/JavaScript-Fundamentals", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "L03. Exercise - Syntax, Operators and Logic Flow/19. Quadratic Equation.js", "max_issues_repo_name": "tchenkov/JavaScript-Fundamentals", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "L03. Exercise - Syntax, Operators and Logic Flow/19. Quadratic Equation.js", "max_forks_repo_name": "tchenkov/JavaScript-Fundamentals", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.8076923077, "max_line_length": 64, "alphanum_fraction": 0.5454545455}
function quadraticEquation(a, b, c) {
    let discriminant = b * b - 4 * a * c;

    if (discriminant > 0){
        let x1 = ((-1 * b) - Math.sqrt(discriminant)) / (2 * a);
        let x2 = ((-1 * b) + Math.sqrt(discriminant)) / (2 * a);

        console.log(Math.min(x1, x2));
        console.log(Math.max(x1, x2));
    } else if (discriminant < 0){
        console.log("No");
    } else {
        let x1 = ((-1 * b) - Math.sqrt(discriminant)) / (2 * a);
        console.log(x1);
    }
}

// function tests
quadraticEquation(6, 11, -35);
console.log();
quadraticEquation(1, -12, 36);
console.log();
quadraticEquation(5, 2, 1);
console.log();
quadraticEquation(5, 6, 1);
