O'Reilly logo

Learning Perl, Second Edition by Randal L. Schwartz, Tom Christiansen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

2.10. Exercises

See Appendix A for answers.

  1. Write a program that computes the circumference of a circle with a radius of 12.5. The circumference is 2 times the radius, or about 2 times 3.141592654 times the radius.

  2. Modify the program from the previous exercise to prompt for and accept a radius from the person running the program.

  3. Write a program that prompts for and reads two numbers, and prints out the result of the two numbers multiplied together.

  4. Write a program that reads a string and a number, and prints the string the number of times indicated by the number on separate lines. (Hint: use the "x" operator.)

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required