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.
30 lines
863 B
30 lines
863 B
5 years ago
|
## fprime
|
||
|
|
||
|
### Instructions
|
||
|
|
||
![]()
5 years ago
|
Write a program that takes a positive `int` and displays its prime factors, followed by a newline (`'\n'`).
|
||
5 years ago
|
|
||
5 years ago
|
- Factors must be displayed in ascending order and separated by `*`.
|
||
5 years ago
|
|
||
![]()
4 years ago
|
- If the number of arguments is different from 1, if the argument is invalid or if the integer doesn't have a prime factor, the program displays nothing.
|
||
5 years ago
|
|
||
![]()
5 years ago
|
### Usage
|
||
5 years ago
|
|
||
|
```console
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test 225225
|
||
5 years ago
|
3*3*5*5*7*11*13
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/test$ ./test 8333325
|
||
5 years ago
|
3*3*5*5*7*11*13*37
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/test$ ./test 9539
|
||
5 years ago
|
9539
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/test$ ./test 804577
|
||
5 years ago
|
804577
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/test$ ./test 42
|
||
5 years ago
|
2*3*7
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/test$ ./test a
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test 0
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test 1
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
5 years ago
|
```
|