• + 0 comments

    Could be better. But here it is in golang:

    func plusMinus(arr []int32) {
        var pos int32
        var negs int32
        var zeros int32
        for _, a := range arr{
            if a < 0 {
                negs++
            } else if a > 0{
                pos++
            } else{
                zeros++
            }
            
        }
        positives := float32(pos) / float32(len(arr))
        negatives := float32(negs) / float32(len(arr))
        zers := float32(zeros) / float32(len(arr))
        fmt.Printf("%.6f\n%.6f\n%.6f\n", positives, negatives, zers)
        
    
    }