1 ffd9a51f 2023-08-04 jrmu #!/usr/bin/perl
3 ffd9a51f 2023-08-04 jrmu # Write a program that computes the circumference of a circle with a radius of
4 ffd9a51f 2023-08-04 jrmu # 12.5. Circumference is 2π times the radius (approximately 2 times
5 ffd9a51f 2023-08-04 jrmu # 3.141592654). The answer you get should be about 78.5.
7 ffd9a51f 2023-08-04 jrmu use warnings;
11 ffd9a51f 2023-08-04 jrmu sub circum {
12 ffd9a51f 2023-08-04 jrmu my $π = 3.141592654;
13 ffd9a51f 2023-08-04 jrmu my ($radius) = @_;
14 ffd9a51f 2023-08-04 jrmu return 2*$π*$radius;
17 ffd9a51f 2023-08-04 jrmu print "circumference = " . circum(12.5) . "\n";