mdhat13

circumference programV4(working)

Feb 16th, 2012
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!C:\Strawberry\perl\bin
  2. use warnings;
  3.  
  4. my $stop = 0;
  5. until ($stop != 0) {   
  6.    
  7.    
  8.     print "this program will compute the circumfrence of a circle.\n";
  9.     print "\n";
  10.     print "Please enter in the radius of your circle.\n";
  11.     $radius = <STDIN>;
  12.     until ($radius ne "\n") {
  13.         print "please enter a number ";
  14.         $radius = <STDIN>;
  15.     }
  16.    
  17.     print "The radius of your circle is "; 
  18.     print 2 * 3.141592654 * $radius;
  19.     print "\n";
  20.     print "do you want to calculate another?(yes/no)\n";
  21.     $stop = 0;
  22.     $answer = <STDIN>;
  23.     if ($answer eq "no\n") {
  24.         print "exiting.... \n";
  25.         $stop = 1;
  26.    
  27.     } else {
  28.         $stop = 0;
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment