Academy Result problem - why is it wrong ?
https://hyperskill.org/learn/step/2743
Your system results my code as wrong. Why ?
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int first = scanner.nextInt();
int second = scanner.nextInt();
int divider = scanner.nextInt();
int vysledok = 0;
while (first <= second) {
if (first % divider == 0) {
vysledok++;
first += divider;
} else {
first += divider;
}
}
System.out.println(vysledok);
}
}
Please sign in to leave a comment.