mockingbird_ls

Circle area

Feb 5th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.31 KB | None | 0 0
  1. #$usr/bin/perl
  2. use 5.010;
  3. use warnings;
  4. use strict;
  5. use Math::Trig;
  6.  
  7. #ex1 finding area of a circle
  8. say "Enter the radius";
  9.  
  10. chomp(my $radius = <STDIN>);
  11.  
  12. if($radius >= 0 ){
  13.    
  14.     my $area = pi*2*$radius;
  15.     printf "The area of the circle is: %.2f\n", $area;
  16.    
  17. }
  18. else{
  19.     say "The area is 0";
Advertisement
Add Comment
Please, Sign In to add comment