Algorithm


. problem Link : https://www.codechef.com/problems/INTEST 

Problem

You are given  integers. Find the count of numbers divisible by .

Input Format

The input begins with two positive integers . The next  lines contains one positive integer each denoted by ��.

Output Format

Output a single number denoting how many integers are divisible by .

Constraints

  • 1≤�,�≤107
  • 1≤��≤109

Sample 1:

Input
 
Output
 
7 3
1
51
966369
7
9
999996
11
4

Explanation:

The integers divisible by 3 are 51,966369,9, and 999996. Thus, there are 4 integers in total.

Code Examples

#1 Code Example with C Programming

Code - C Programming

 #include<stdio.h>
int main()
{
    int n,k,num,count=0;
    scanf("%d %d",&n,&k);
    while(n--)
    {
        scanf("%d",&num);
        if(num%k==0) 
        {
            count++;
        }
    }
    printf("%d\n",count);
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
7 3
1
51
966369
7
9
999996
11

Output

x
+
cmd
4
Advertisements

Demonstration


CodeChef solution INTEST  - Enormous Input Test in  Codechef solution in C,C++

Previous
CodeChef solution FLOW004 - ,First and Last Digit CodeChef solution in C,C++
Next
CodeChef solution in INCRIQ - Increase IQ Codechef solution in C,C++