<?php
// “Impossivel calcular”, caso haja uma divisão por 0 ou raiz de numero negativo.
$valores = trim(fgets(STDIN));
$valoresArray = explode(" ",$valores);
[$a,$b,$c] = array_map('floatval',$valoresArray);
$delta = (($b)**2) - (4*$a*$c);
if(2*$a == 0 || $delta <= 0)
{
echo "Impossivel calcular".PHP_EOL;
}elseif($delta > 0)
{
$r1 = (-($b) + sqrt($delta))/(2*$a);
$r2 = (-($b) - sqrt($delta))/(2*$a);
echo "R1 = " . number_format($r1,5,".","") . PHP_EOL;
echo "R2 = " . number_format($r2,5,".","") . PHP_EOL;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: