Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <meta charset="UTF-8" />
- </head>
- <body>
- <form action="new2.php" method="get">
- Podaj x: <input type="number" name="x"><br>
- Podaj y: <input type="number" name="y"><br>
- Podaj a: <input type="number" name="a"><br>
- Podaj b: <input type="number" name="b"><br>
- Podaj c: <input type="number" name="c"><br>
- <input type="submit" value="wyślij">
- </form>
- </body>
- </html>
- <html>
- <head>
- <meta charset="UTF-8"/>
- </head>
- <body>
- <?php
- $x=$_GET['x'];
- $y=$_GET['y'];
- $a=$_GET['a'];
- $b=$_GET['b'];
- $c=$_GET['c'];
- $obwod=2*$x + 2*$y;
- $pole=$x * $y;
- $delta=$b*$b - 4*$a*$c;
- echo "<li>Obwód prostokąta o bokach ";
- echo $x;
- echo " i ";
- echo $y;
- echo " = ";
- echo $obwod."<br>"."<br>";
- echo "<li>Pole prostokąta o bokach ";
- echo $x;
- echo " i ";
- echo $y;
- echo " = ";
- echo $pole."<br>"."<br>";
- echo "Delta o a = ";
- echo $a;
- echo ", b = ";
- echo $b;
- echo " i c = ";
- echo $c;
- echo " = ";
- echo $delta."<br>";
- if ($delta < 0) {
- echo ("Równanie nie ma miejsc zerowych");
- } else if ($delta == 0) {
- $x1 = -$b/(2 * $a);
- echo ("Równanie ma jedno miejsce zerowe: $x1");
- } else {
- $x1 = (-$b-sqrt($delta))/(2*$a);
- $x2 = (-$b+sqrt($delta))/(2*$a);
- echo ("Równanie ma dwa miejsca zerowe: x1 = ".$x1." i x2 = ".$x2);
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement