Problem of hackerearth

You have been given 3 integers - l, r and k. Find how many numbers between l and r (both inclusive) are divisible by k. You do not need to print these numbers, you just have to find their count.

Input Format
The first and only line of input contains 3 space separated integers l, r and k.

Output Format
Print the required answer on a single line.

Constraints
1<=l<=r<=1000
1<=r<=1000

SAMPLE INPUT
1 10 1
SAMPLE OUTPUT
10

sir how to approach this problem can you plz tell

hello @qudsiya
it is a simple loop based problem.
int cnt=0;
for(int i=l ; i<=r;i++){
if(i%k==0){
cnt++;
}
}

iterate from i=l …r
if i%k==0 then increment ur count

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.