Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CON-#### Add IS-Negative subject #1198

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions subjects/str_isnegative/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

# IS-Negative

### Instructions

Write a function named `StrisNegative()` that defines if a number (You should check if it's a number) is negative or positive.

- Your function print P if the number is positive
- Your function print F if the number is negative
- For the number 0 is zero print 0.
- Any input other than number should print !
- Your function should always print ('\n')at the end of the output.

### Expected function

```go
func StrisNegative(str string){
//code
}
```

### Usage

```go
package main

import (
"os"
"piscine"
"fmt"
)

func main() {
argument := os.Args[1:]
piscine.StrisNegative(argument[0])
}
```
And its output:

```console
$ go run . | cat -e
!$
$ go run . "7" | cat -e
P$
$ go run . "-9" | cat -e
N$
$ go run . a | cat -e
!$
$ go run . "-552" | cat -e
N$
$ go run . "58" | cat -e
P$
$ go run . "Hello World" | cat -e
!$
```
Loading