mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
562 B
41 lines
562 B
5 years ago
|
## priorprime
|
||
|
|
||
|
### Instructions
|
||
|
|
||
|
You are given an integer.
|
||
|
Your function must return sum of all prime numbers prior to the number exclusively. The number is not included.
|
||
5 years ago
|
|
||
|
### Expected function and structure
|
||
5 years ago
|
|
||
|
```go
|
||
5 years ago
|
package main
|
||
5 years ago
|
|
||
5 years ago
|
func PriorPrime(x int) int {
|
||
5 years ago
|
|
||
|
}
|
||
|
```
|
||
|
|
||
|
### Usage
|
||
5 years ago
|
|
||
5 years ago
|
Here is a possible program to test your function:
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
5 years ago
|
import "fmt"
|
||
5 years ago
|
|
||
|
func main() {
|
||
5 years ago
|
fmt.Println(PriorPrime(14))
|
||
5 years ago
|
}
|
||
|
|
||
|
```
|
||
|
|
||
|
Its output:
|
||
|
|
||
|
```console
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./priorprime
|
||
5 years ago
|
41
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/test$
|
||
5 years ago
|
```
|