title: Float return zero in golang
body: <p>Why does this code always return zero:</p>
  
  <pre><code>package main
  
  import "fmt"
  
  func main() {
      var index_of_array int
      fmt.Scan(&amp;index_of_array)
      var arr = make([]int, index_of_array)
      for i := 0; i &lt; len(arr); i++ {
          fmt.Scan(&amp;arr[i])
      }
  
      positive := 0
      negative := 0
      zero_ := 0
      for _, arr_v := range arr {
          if arr_v &gt; 0 {
              positive++
          } else if arr_v &lt; 0 {
              negative++
          } else if arr_v == 0 {
              zero_++
          }
      }
  
      fmt.Printf("%f ", float32(positive/len(arr)))
      fmt.Printf("%f ", float32(negative/len(arr)))
      fmt.Printf("%f ", float32(zero_/len(arr)))
  
  }
  </code></pre>
  
  <p>i mean to output</p>
  
  <p>A decimal representing of the fraction of positive numbers in the array.
   A decimal representing of the fraction of negative numbers in the array.
   A decimal representing of the fraction of zeroes in the array.</p>
  
  <p>Sample Input</p>
  
  <p>6</p>
  
  <p>-4 3 -9 0 4 1</p>
  
  <p>Sample Output</p>
  
  <p>0.500000</p>
  
  <p>0.333333</p>
  
  <p>0.166667</p>
  
  <p>but in my code the output like this with the same input</p>
  
  <p>0.000000</p>
  
  <p>0.000000</p>
  
  <p>0.000000</p>