A very simple program to ask the user to give a value in radius and then our program will compute the diameter, circumference and area of a circle using PERL as our programming language.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is +63 (034) 4335675.
Sample Program Output
Program Listing
circle.pl
use Math::Round;
print "\n\n";
print "Diameter, Circumference and Area of a Circle in PERL";
print "\n\n";
print "Created By Mr. Jake R. Pomperada,MAED-IT";
print "\n\n";
print "What is the radius? : ";
$r = <>;
$diameter = (2 * $r);
$area = (3.1416 * ($r ** 2));
$circum = ($diameter * 3.14);
my $diameter2 = nearest(.1,$diameter);
my $area2 = nearest(.1,$area);
my $circum2 = nearest(.1,$circum);
print "\n\n";
print "===== DISPLAY RESULT =====";
print "\n\n";
print "The diameter of the circle is $diameter2.";
print "\n\n";
print "The area of the circle is $area2. ";
print "\n\n";
print "The Circumference of the circle is $circum2.";
print "\n\n";
print "End of Program";
print "\n\n";