public/subjects/addprimesum/README.md

26 lines
456 B
Markdown
Raw Permalink Normal View History

2019-05-02 13:07:48 +00:00
## addprimesum
### Instructions
2019-10-09 21:42:35 +00:00
Write a program that takes a positive integer as argument and displays the sum of all prime numbers inferior or equal to it followed by a newline (`'\n'`).
2019-05-02 13:07:48 +00:00
2020-02-25 12:02:16 +00:00
- If the number of arguments is different from 1, or if the argument is not a positive number, the program displays `0` followed by a newline.
2019-05-02 13:07:48 +00:00
### Usage
2019-05-02 13:07:48 +00:00
```console
$ go run . 5
2019-05-02 13:07:48 +00:00
10
$ go run . 7
2019-05-02 13:07:48 +00:00
17
$ go run . -2
2020-03-08 11:37:26 +00:00
0
$ go run . 0
2019-05-02 13:07:48 +00:00
0
$ go run .
2020-02-23 11:02:38 +00:00
0
$ go run . 5 7
2020-03-08 11:37:26 +00:00
0
$
2019-05-02 14:10:02 +00:00
```