vis1982 has asked for the wisdom of the Perl Monks concerning the following question:
and u have a input number given 4,8,3 Still it print as zero Why??#!/usr/bin/perl use strict; open(FH,"$ARGV[0]") or die; my @temp=<FH>; close FH; my $quadratic = quadratic (\@temp); print "$quadratic\n"; sub quadratic { my ($a, $b, $c) = @_; return (-$b + sqrt($b*$b - 4*$a * $c)) / 2*$a; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: solving a quadratic equation
by RMGir (Prior) on Dec 08, 2009 at 12:46 UTC | |
|
Re: solving a quadratic equation
by Anonymous Monk on Dec 08, 2009 at 12:44 UTC | |
|
Re: solving a quadratic equation
by GrandFather (Saint) on Dec 08, 2009 at 21:47 UTC | |
|
Re: solving a quadratic equation
by ambrus (Abbot) on Dec 08, 2009 at 14:37 UTC | |
by SuicideJunkie (Vicar) on Dec 08, 2009 at 14:57 UTC |