SHARE
TWEET

Untitled

a guest Jul 2nd, 2017 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/perl
  2.  
  3. $ARGV=@ARGV;
  4. if ($ARGV < 3){ print "wtf?"; exit;}
  5.  
  6. $a=$ARGV[0];
  7. $b=$ARGV[1];
  8. $c=$ARGV[2];
  9. $D = $b*$b - 4*$a*$c;
  10. print "D=".$D."\n";
  11. if ($D<0){
  12.     print "D<0... Exit...";
  13.     exit;
  14. }
  15. if ($D==0){
  16.     $x= (-$b + sqrt($b*$b - 4*$a*$c))/(2*$a);
  17.     print $x;
  18.     exit;
  19. }
  20. if ($D>0){
  21.     $x1 = (-$b + sqrt($b*$b - 4*$a*$c))/(2*$a);
  22.     $x2= (-$b - sqrt($b*$b - 4*$a*$c))/(2*$a);
  23.     print "X+ = ".$x1."\n";
  24.     print "X- = ".$x2."\n";
  25.     exit;
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top