note 118690 deleted from control-structures.if by peehaa
| From: | peehaa@php.net | Date: | Wed, 12 Oct 2016 13:06:44 +0000 |
| Subject: | note 118690 deleted from control-structures.if by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-206845@lists.php.net to get a copy of this message | ||
Note Submitter: ronson at web dot com
----
$det = $b*$b-4*$a*$c;
if ($det <0)
{
echo "Die Gleichung $a⋅x² + $b⋅x + $c = 0 hat keine
Lösung.";
}
elseif ($det ==0)
{
$loesung = round(-$b/(2*$a),2);
echo "Die Gleichung $a⋅x² + $b⋅x + $c = 0 hat die Lösung
$loesung.";
}
elseif ($det > 0)
{
$loesung1 = round((-$b+sqrt($det))/(2*$a),2);
$loesung2 = round((-$b-sqrt($det))/(2*$a),2);
echo "Die Gleichung $a⋅x² + $b⋅x + $c = 0 hat die Lösungen
$loesung1 und $loesung2.";
}