Last active
December 17, 2015 00:29
-
-
Save abouolia/1cee66b9cf1b6ed0480a to your computer and use it in GitHub Desktop.
Second Degreee Quation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function Seconddegreeequation( $a, $b, $c, $g=null){ | |
if ( $g == 1 || $g == true){ | |
$val = (-1 * $b) + sqrt(pow($b, 2) - 4*$a*$c); | |
}else{ | |
$val = (-1 * $b) - sqrt(pow($b, 2) - 4*$a*$c); | |
} | |
$val2 = 2*$a; | |
return $val / $val2; | |
} | |
echo Seconddegreeequation(1, -3, -18, true); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment