Input

The input begins with two positive integers n k (n, k<=10^7). The next n lines of input contain one positive integer ti, not greater than 109, each.
Output

Write a single integer to output, denoting how many integers ti are divisible by k.
my code is.........

#include<stdio.h>
     
    
    int main()
    {
    int t,i=1,j=0,k;
  int n;
  
    scanf("%d%d", &t,&k);
  if(t>0&&k>0)
  {
    while(i<=t){
    scanf("%d",&n);
   
    if(n%k==0)
    j++;
    i++;
}
    printf("%d",j);
}
    
    return 0;
    }

Whats wrong?

will u please give me exampl and its expected output i am not getting your problem

Those requirements are odd. Given the ranges of ti and k , I would expect to check if ti evenly divides k , not if ti is divisible by k . Any k larger than 109 in the latter case is completely predictable and need not be checked.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.