Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
- <title>Formularz</title>
- </head>
- <body>
- <form method="get" action="">
- <div>
- <label>A: <input type="text" name="aa" /></label>
- <label>B: <input type="text" name="bb" /></label>
- <label>C: <input type="text" name="cc" /></label>
- <input type="submit" value="Sprawdź" />
- </form>
- </div>
- <p>
- <?php
- $a = $_GET['aa'];
- $b = $_GET['bb'];
- $c = $_GET['cc'];
- $delta = pow($b, 2) - 4 * $a * $c;
- $pierwdelta = sqrt($delta);
- if ($delta > 0){
- $x1 = (-$b-$pierwdelta)/2*$a;
- $x2 = (-$b+$pierwdelta)/2*$a;
- $text = "dwa pierwiastki<br>";
- echo $text;
- echo "x1 równa się ".$x1."<br>";
- echo "x2 równa się ".$x2."<br>";
- echo $delta;
- }
- if ($delta == 0){
- $x0 = (-$b/(2*$a));
- $text = "jeden pierwiastek<br>";
- echo $text;
- echo "x0 równa się ".$x0."<br>";
- echo $delta;
- }
- if ($delta < 0){
- $text = "brak pierwiastków<br>";
- echo $text;
- echo $delta;
- }
- ?>
- </p>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement