//-----------------------Problema 1-----------------------
if(isset($_GET['1a']) && isset($_GET['1b']) && isset($_GET['1c']))
{
$a=$_GET['1a'];
$b=$_GET['1b'];
$c=$_GET['1c'];
if($a-$b == $b-$c)
echo "Numerele ".$a.", ".$b.", ".$c." sunt in progresie aritmetica";
else
echo "Numerele ".$a.", ".$b.", ".$c." nu sunt in progresie aritmetica";
}
//--------------------------------------------------------
//-----------------------Problema 2-----------------------
if(isset($_GET['nr']))
{
$nr=$_GET['nr'];
echo "Primii 5 multipli ai lui ".$nr." sunt:";
$i=0;
$a=$nr;
while($i<5)
{
$a+=$nr;
echo $a.", ";
$i++;
}
}
//--------------------------------------------------------
//-----------------------Problema 3-----------------------
if(isset($_GET['3a']) && isset($_GET['3b']) && isset($_GET['3c']))
{
$a=$_GET['3a'];
$b=$_GET['3b'];
$c=$_GET['3c'];
echo "Produsul nr.".$a.", ".$b.", ".$c." este: ".($a*$b*$c);
echo "
";
echo "Suma nr.".$a.", ".$b.", ".$c." este: ".($a+$b+$c);
echo "
";
echo "Media aritmetica a nr. ".$a.", ".$b.", ".$c." este: ".round(($a+$b+$c)/(3),2);
}
//--------------------------------------------------------
//-----------------------Problema 4-----------------------
if(isset($_GET['4a']) && isset($_GET['4b']) && isset($_GET['4c']))
{
$a=$_GET['4a'];
$b=$_GET['4b'];
$c=$_GET['4c'];
$E1=$a+$b-$c;
$E2=3*$E1*$b;
$E3=($a-$E2)*($b-$c);
echo "a=".$a." b=".$b." c=".$c."
";
echo "E1 = ".$E1."
E2 = ".$E2."
E3 = ".$E3;
}
//--------------------------------------------------------
//-----------------------Problema 5-----------------------
if(isset($_GET['5a']) && isset($_GET['5b']) && isset($_GET['5c']))
{
$a=$_GET['5a'];
$b=$_GET['5b'];
$c=$_GET['5c'];
$max = 0;
if($a > $b && $a > $c)
$max = $a;
if($b > $a && $b > $c)
$max = $b;
if($c > $a && $c > $b)
$max = $c;
echo "Maximul dintre ".$a.", ".$b.", ".$c." este ".$max;
}
//--------------------------------------------------------
//-----------------------Problema 6-----------------------
if(isset($_GET['c1']) && isset($_GET['c2']) && isset($_GET['c3']))
{
$c1=$_GET['c1'];
$c2=$_GET['c2'];
$c3=$_GET['c3'];
echo "1: ".$c1." ".$c2." ".$c3."
";
echo "2: ".$c1." ".$c3." ".$c2."
";
echo "3: ".$c3." ".$c2." ".$c1."
";
echo "4: ".$c3." ".$c1." ".$c2."
";
echo "5: ".$c2." ".$c1." ".$c3."
";
echo "6: ".$c2." ".$c3." ".$c1."
";
}
//--------------------------------------------------------
//-----------------------Problema 7-----------------------
if(isset($_GET['n8']) && isset($_GET['m8']))
{
function procent($numb1, $numb2)
{
if($numb1 > 0)
{
return round($numb2 / ($numb1 / 100),2);
}
else
{
return 0;
}
}
$n8=$_GET['n8'];
$m8=$_GET['m8'];
if($m8 > $n8)
echo "date incorecte";
else
echo procent($n8,$m8)."% din elevi sunt in ultimul an de liceu";
}
//--------------------------------------------------------
//-----------------------Problema 8-----------------------
if(isset($_GET['x1']) && isset($_GET['x2']) && isset($_GET['x3']) && isset($_GET['x4']) && isset($_GET['y1']) && isset($_GET['y2']) && isset($_GET['y3']) && isset($_GET['y4']))
{
$x1 = $_GET['x1']; $y1 = $_GET['y1'];
$x2 = $_GET['x2']; $y2 = $_GET['y2'];
$x3 = $_GET['x3']; $y3 = $_GET['y3'];
$x4 = $_GET['x4']; $y4 = $_GET['y4'];
echo "P1(".$x1.",".$y1.")
";
echo "P2(".$x2.",".$y2.")
";
echo "P3(".$x3.",".$y3.")
";
echo "P4(".$x4.",".$y4.")
";
$dx1 = $x3-$x1;
$dy1 = $y3-$y1;
$l1 = round(sqrt(pow($dx1,2)+pow($dy1,2)),2); // Lungimea segmentului (P1,P3)
$dx2 = $x4-$x2;
$dy2 = $y4-$y2;
$l2 = round(sqrt(pow($dx2,2)+pow($dy2,2)),2); // Lungimea segmentului (P2,P4)
echo "Lungimea segmentului (P1,P3): ".$l1."
";
echo "Lungimea segmentului (P2,P4): ".$l2."
";
if($l1 > $l2)
echo "Lungimea segmentului (P1,P3) este mai mare decat lungimea segmentului (P2,P4)";
if($l2 > $l1)
echo "Lungimea segmentului (P2,P4) este mai mare decat lungimea segmentului (P1,P3)";
else
echo "Lungimea segmentului (P2,P4) este egala cu lungimea segmentului (P3,P1)";
}
//--------------------------------------------------------
?>