|
|
@ -1,13 +1,12 @@ |
|
|
|
## get-area |
|
|
|
## get-area |
|
|
|
|
|
|
|
|
|
|
|
### instructions |
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Write a program that takes a positive number as radius and prints the area of a circle. |
|
|
|
|
|
|
|
- The area of the circle is `3.14` times the radius squared. |
|
|
|
|
|
|
|
- Only positive numbers will be accepted, otherwise print `Error` followed by (`'\n'`) |
|
|
|
|
|
|
|
- if the number of arguments is not `1` print (`'\n'`) |
|
|
|
|
|
|
|
|
|
|
|
- Write a program that takes a number and prints the area of the circle. |
|
|
|
|
|
|
|
- The area of the circle is `π` times the radius squared. |
|
|
|
|
|
|
|
- if the number is not positive or is not a number, print `Error` followed by (`'\n'`) |
|
|
|
|
|
|
|
- if the number is positive, print the area of the circle followed by (`'\n'`) |
|
|
|
|
|
|
|
- if the number of arguments is not `1` print (`'\n'`) |
|
|
|
|
|
|
|
- You may assume that the value of `π` is 3.14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Usage |
|
|
|
### Usage |
|
|
|
|
|
|
|
|
|
|
@ -15,7 +14,7 @@ |
|
|
|
$ go run . | cat -e |
|
|
|
$ go run . | cat -e |
|
|
|
$ |
|
|
|
$ |
|
|
|
$ go run . 10 | cat -e |
|
|
|
$ go run . 10 | cat -e |
|
|
|
315$ |
|
|
|
314$ |
|
|
|
$ go run . 4 | cat -e |
|
|
|
$ go run . 4 | cat -e |
|
|
|
50$ |
|
|
|
50$ |
|
|
|
$ go run . -10 | cat -e |
|
|
|
$ go run . -10 | cat -e |
|
|
|