index
| submit
| rank
| book

## pi – Circumference and Area

Given the radius of a circle, calculate its circumference and area.

The *circumference* of a circle with radius *r* is given by 2 × π × *r*
or two times pi times the radius.

The *area* of a circle with radius *r* is given by π × *r* ²
or pi times the square of the radius.

The number π, or pi, is a mathematical constant with an irrational value of
3.141 592 653 …

### Input and Output

Each line of input contains a decimal value *r* indicating the radius.

0 < *r* < 10000.0

For each line of input, your program should produce two numbers,
*c* and *a* indicating the circumference and area.
They should be rounded to two decimal places.

#### Example input

```
1
12
6.6
0.159
```

#### Example output

```
6.28 3.14
75.40 452.39
41.47 136.85
1.00 0.08
```

### Functions `circumference`

and `area`

To reach a full score your program should implement two functions
`circumference`

and `area`

.
Each should take a double-precision floating point number
and return a double-precision floating point number.
Please see the information for your programming language of choice:

- C:
`double circumference(double r);`

and `double area(double r);`

- Python:
`def circumference(r):`

and `def circumference(r):`

- Haskell:
`circumference :: Double -> Double`

and `area :: Double -> Double`

- C++:
`double circumference(double r);`

and `double area(double r);`

### Scoring

- 1/6: works for the above example but with an incorrect output format
- 2/6: works for the above example with the correct output format
- 3/6: works for circles with an integral radius
- 4/6: works for circles with fractional radiuses
- 5/6: works for edge cases
- 6/6: implements
`circumference`

and `area`

### Hints

**The value of π (pi).**
The value of π (pi) is a real number so the only way to represent it as a
floating point value is to use an approximation.
Although you can use a hardcoded value of `3.141592653589793`

for π
it is better to use the one provided by your programming language of
choice:

- in C, use
`M_PI`

from `math.h`

;
- in Python, use
`pi`

from the `math`

module (a.k.a.: `math.pi`

);
- in Haskell use
`pi`

from the `Prelude`

.

try first: mult

try next: oddeven order

index
| submit
| rank
| book

Copyright © 2020-2021 Rudy Matela

All rights reserved