You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
567 B

#!/usr/bin/env perl
use strict;
use warnings;
use Math::Complex;
print "Entrez-vous\n";
my ($a, $b, $c) = (rand(100), rand(100), rand(100));
print "\$a=$a\n";
print "\$b=$b\n";
print "\$c=$c\n";
sub quad {
my ($a, $b, $c) = @_;
my $positive = (
($b * -1) - sqrt(($b ** 2) - (4 * ($a * $c))) / (2 * $a)
);
my $negative = (
($b * -1) + sqrt(($b ** 2) - (4 * ($a * $c))) / (2 * $a)
);
return ($positive, $negative);
}
my @result = quad($a, $b, $c);
printf("%s, %s\n", $result[0], $result[1]);
1;
__END__
1;
__END__