Embercode
✕
LoopsCoding problems

Loops: coding problems

Write a program that reads the input and prints the answer. Run checks it against every test, including hidden ones.

0 of 7 solved

  • A bike route has checkpoints numbered from a to b, both included. Every checkpoint whose number is a multiple of k gets a water station. Zero is a multiple of every number.

    Count the water stations.

    **Constraints:** -1000 <= a <= b <= 1000 and 1 <= k <= 1000.

    Input. One line with three integers a, b and k.

    Output. One integer: the number of checkpoints whose number is a multiple of k.

    Example 1 input

    1 10 3
    

    Output

    3

    Example 2 input

    -5 5 2
    

    Output

    5