用Scanf进行偶数和奇数golang打印

package main 
import "fmt"
func main(){
  fmt.Println("Enter a number: ")
  var i int32
  fmt.Scanf("f",%i)
  output := i*1
  if output%2 == 0{
    fmt.Print("even")
}else {
  fmt.Println("odd")
}
}

This is my current code. I am trying to print even and odd number based on using the Scanf but this only print out 'Even'.

fmt.Scanf (docs) takes a format string as the first argument. You are providing "f" which is invalid. If you read and reacted to the error returned then you would see the error "input does not match format". This is a working example doing what I believe you originally intended:

package main

import "fmt"

func main() {
    fmt.Printf("Enter a number: ")
    var i int32
    _, err := fmt.Scanf("%d", &i)
    if err != nil {
        fmt.Printf("%v
", err)
        // maybe a good time to exit
    }
    if i%2 == 0 {
        fmt.Print("even")
    } else {
        fmt.Println("odd")
    }
}

The reason you were always getting "even" is because i was always equal to 0, and zero is even.