In: Computer Science
Write a complete Java program to solve the following problem.
Read two positive integers from the user and print all the multiple of five in between them. You can assume the second number is bigger than the first.
For example if the first number is 1 and the second number is 10, then your program should output
5 10
Java must be grade 11 work easy to understand and not complicated code
/*If you any query do comment in the comment section else like the solution*/
import java.util.Scanner;
class MultipleOfFive {
public static void main(String[]args) {
Scanner sc = new Scanner(System.in);
int low, high;
System.out.println("Enter two numbers: ");
low = sc.nextInt();
high = sc.nextInt();
//Running a loop starting from low to high
while(low <= high) {
//if a number is divisible by 5 then low divided by five will give remainder zero
if(low % 5 == 0) {
System.out.print(low + " ");
}
low++;
}
}
}