Last Updated: 7 Dec, 2025

Batch Quality Control

Easy
Asked in company
Freecharge

Problem statement

You are working at a factory that produces electronic components. Each component is assigned a unique serial number. As part of a new quality control initiative, a component is flagged for inspection if its serial number is evenly divisible by a specific integer K.


You are given a batch of N components, represented by an array A of their serial numbers, and a single integer K. Your task is to count how many components in this batch need to be flagged for inspection.


Input Format:
The first line of input contains two space-separated integers, N (the number of components) and K (the divisor).

The second line contains N space-separated integers, the elements of the array A (the serial numbers).


Output Format:
The output should be a single integer representing the total count of elements in A that are evenly divisible by K.


Note:
An integer a is evenly divisible by an integer b if the remainder of their division is 0. In most programming languages, this is checked with the modulo operator: a % b == 0.

The value of K will always be a positive integer.