Jump to content

ftpkid

Members
  • Posts

    2
  • Joined

  • Last visited

Profile Information

  • Interests
    i bite

ftpkid's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Hello, I'm a beginner and i just wrote an extremely simple program for solving a linear equation. It works, but i was wondering if you guys can take a look. Here it is: <?php$a = 5;$b = 10;$r = -($b/$a);if($a == 0 && $b == 0) {echo 'There are infinitely many solutions';}elseif($a>0 && $b>0) {echo $r;}elseif($a>0 && $b == 0) {echo 'X is equal to zero';}else {echo 'There are no solutions';}?> It's really, really basic and some parts aren't really correct(i guess). Please, tell me what you think. It isn't really complete, because the variable "a", might be a negative number. Also the code isn't exactly the most beautiful one... I didn't make an HTML form, so that the user can write the constants, on purpose.
×
×
  • Create New...