I am sorry i am replying your post, with new problem.
I am trying to get vlue of X positive and Negative. i am using array. It did not do the calculation part but i got out put
Cofficients: 2 5 1
Can not do the negetive calculations
Illegal division by zero at pgm4.pl line 31, <> line 1.
so i think some thing wrong in if statement i could not figuring out where is mistake. I will really apriciate it if someone show me the way.
print "Cofficients: ";
$input =<>;
@input = split(' ', $input);
($vol, $vol1, $ vol2) = @input;
print "\n";
$test0 = ($vol1**2-4*($vol*$vol2));
if (test0 <1)
{
print "Can not do the negetive calculations\n\n";
}
$test1 = (2*$vol);
if ($test1 <= 0)
{
print "Can not divide by zero\n\n";
}
$x = (-$vol + sqrt($test0))/(test1);
$negative = (-$vol - sqrt($test0))/(test1);
if ($x = $negative)
{
print "$x";
exit;
}
else
{
print "$x\n $negative";
exit;
}
Thank you in Advance