Skip to content

Instantly share code, notes, and snippets.

@jtprogru
Created May 13, 2022 14:58
Show Gist options
  • Save jtprogru/580afba32788812f3851091b1a203067 to your computer and use it in GitHub Desktop.
Save jtprogru/580afba32788812f3851091b1a203067 to your computer and use it in GitHub Desktop.
По данным числам, определите количество чисел, которые равны нулю. Вводится натуральное число N, а затем N чисел. Выведите количество чисел, которые равны нулю.
package main
import "fmt"
func main() {
var inputNumber int
var counter int
_, _ = fmt.Scan(&inputNumber)
inputArray := make([]int, inputNumber)
for i := 0; i < inputNumber; i++ {
_, _ = fmt.Scan(&inputArray[i])
if inputArray[i] == 0 {
counter += 1
}
}
fmt.Println(counter)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment