Circle Computations



Description

This program will perform two different calculations for a circle:

0. stop execution
1. compute its circumference
2. compute its area

This program will show use of a user-controlled loop, nested conditional statements (if), as well as creation of constants and their use in expressions.

This program is somewhat robust, as it does checking to see in the values the user gives make sense or are in the proper ranges. For example, when asked to input a circle radius, the program will reject negative numbers. In this case, the program goes back to the top of the loop and and has the user begin again. It is not as robust as possible, though; try giving text like "hi there" when asked for a radius.

Input

User will supply one number, when prompted, to tell which computation is desired (in this case, 0, 1, or 2 is needed). Then, when prompted, the use will give a second number... the radius of the circle (units are not important and the radius can be a real number). We also show use of Number() to convert text to numeric data.

Output

The program will print to the screen the value (either area or circumference).

Termination

To end the program the user should give number "0" when selecting a conversion.