You are on page 1of 2

S2 BTech

C Programming

Code-Chef Submission

Name: ANANDHA KRISHNAN. R

Roll No: AM.EN.U4ECE17109

QUESTION: 5: INTEST

BEGINNER

The purpose of this problem is to verify whether the method you are
using to read input data is sufficiently fast to handle problems
branded with the enormous Input/Output warning.

//ANANDHA KRISHNAN.R

#include <stdio.h>

int main() {

int n, k;
scanf("%d %d", &n, &k);

int div = 0;
for (int i = 0; i < n; i++) {
int t;
scanf("%d", &t);

if (t % k == 0) {
div++;
}
}

printf("%d\n", div);

return 0;
}
APPROACH:
Two numbers ‘n’ and ‘k’ are entered ,’div’ is initialised to 0.using for
loop the program is executed n times and then number ‘t’ is entered
and if t is divisible by k the value of div gets incremented by 1 unit
and is printed onto the screen .If all the program constraints are true
then 2.5MB of input data is processed at runtime.

You might also like