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.
 
 
 
 
 
 

872 B

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

func StrisNegative(str string){
    //code
}

Usage

package main

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

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

And its output:

$ 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
!$