The count of numbers divisible by N

Report a typo

Write a program that reads three positive integers a, b, n and outputs the count of numbers divisible by n in the range from a to b (a < b) inclusively.

Note: it is possible to write this program more efficiently without any loops.

Sample Input 1:

10 20 10

Sample Output 1:

2

Sample Input 2:

15 25 5

Sample Output 2:

3
Write a program in Java 17
import java.util.Scanner;

class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// start coding here
}
}
___

Create a free account to access the full topic