#native_company# #native_desc#
#native_cta#

Simple Algebra Problem Solver

By Matt
on June 18, 2003

Version: 1.0

Type: Full Script

Category: Math Functions

License: GNU General Public License

Description: Like the title says. This script solves problems in Ax + B = C form where you’re solving for x. Hope you like it.

<?
###################################################################################################
# This is a stupid little script I wrote in a few minutes just to see if I could figure it out.   #
#You're welcome to use it or modify it however you would like. This is my first script I've wrote #
#to give to people. Hope you like it! Email me at [email protected] with any feedback#
###################################################################################################

function algProblem() {
        print("Now you don't have to do your homework! Solve simple Algebra problems with this script. The problem has to be in Ax + B = C form. Where you're solving for x. Have fun!<p>");
        print("<center><form method="post" action="algebra.php">");
        print("<input type="text" size="5" name="val1" value="first number"><b>x</b> + <input type="text" size="5" name="val2" value="2nd number"><b> = </b><input type="text" size="5" name="val3" value="3rd number">");
        print("<input type="submit" name="submit" value="Solve!">");
        }


if(isset($submit)):

#Algebra problem solver#

$a = $val1;
$b = $val2;
$c = $val3;

#1st step#
#Subtract B from C and get D#

$d = $c - $b;

#2nd Step#
#Divide D by A and get E#

$e = $d / $a;

print("The Answer is:<br> x = $e");


else:
algProblem();
endif;
?>