Count Divisors (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 lr and k.

Output Format
Print the required answer on a single line.

Constraints
1lr1000
1k1000

SAMPLE INPUT
 
1 10 1
SAMPLE OUTPUT
 
10
SOLUTION:
l,r,k = map(int,input().split())
c=0
for i in range(l,r+1):
if i%k==0:
c+=1
print(c)

Comments

Popular posts from this blog

Sort in specific order (GFG)

Chef and Remissness Problem Code: REMISS (CodeChef)

Short Notes Of computer Network