Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. <html>
  2. <head>
  3. <meta charset="UTF-8" />
  4. </head>
  5. <body>
  6. <form action="new2.php" method="get">
  7. Podaj x: <input type="number" name="x"><br>
  8. Podaj y: <input type="number" name="y"><br>
  9. Podaj a: <input type="number" name="a"><br>
  10. Podaj b: <input type="number" name="b"><br>
  11. Podaj c: <input type="number" name="c"><br>
  12. <input type="submit" value="wyślij">
  13.  
  14. </form>
  15. </body>
  16. </html>
  17.  
  18.  
  19.  
  20.  
  21.  
  22. <html>
  23. <head>
  24. <meta charset="UTF-8"/>
  25. </head>
  26. <body>
  27. <?php
  28. $x=$_GET['x'];
  29. $y=$_GET['y'];
  30. $a=$_GET['a'];
  31. $b=$_GET['b'];
  32. $c=$_GET['c'];
  33.  
  34.  
  35. $obwod=2*$x + 2*$y;
  36. $pole=$x * $y;
  37. $delta=$b*$b - 4*$a*$c;
  38.  
  39. echo "<li>Obwód prostokąta o bokach ";
  40. echo $x;
  41. echo " i ";
  42. echo $y;
  43. echo " = ";
  44. echo $obwod."<br>"."<br>";
  45.  
  46. echo "<li>Pole prostokąta o bokach ";
  47. echo $x;
  48. echo " i ";
  49. echo $y;
  50. echo " = ";
  51. echo $pole."<br>"."<br>";
  52.  
  53. echo "Delta o a = ";
  54. echo $a;
  55. echo ", b = ";
  56. echo $b;
  57. echo " i c = ";
  58. echo $c;
  59. echo " = ";
  60. echo $delta."<br>";
  61. if ($delta < 0) {
  62. echo ("Równanie nie ma miejsc zerowych");
  63. } else if ($delta == 0) {
  64. $x1 = -$b/(2 * $a);
  65. echo ("Równanie ma jedno miejsce zerowe: $x1");
  66. } else {
  67. $x1 = (-$b-sqrt($delta))/(2*$a);
  68. $x2 = (-$b+sqrt($delta))/(2*$a);
  69. echo ("Równanie ma dwa miejsca zerowe: x1 = ".$x1." i x2 = ".$x2);
  70. }
  71.  
  72. ?>
  73. </body>
  74. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement