efrei/scripting/perl/circonference_radius_from_user.pl
2022-07-08 08:53:48 +02:00

16 lines
425 B
Perl
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env perl
use strict;
use warnings;
use Math::Trig;
# Programme qui calcule la circonférence dun cercle de rayon saisi par l'utilisateur.
print "Entrez le rayon d'un cercle afin d'en calculer la circonférence : ";
my $radius = <STDIN>;
chomp $radius;
$radius += 0 or die "$radius n'est pas un nombre !\n";
my $circ = 2 * pi * $radius;
print "La circonférence d'un cercle de rayon $radius est : $circ\n";