Question #17131

Write a Java application that prints the numbers between LOW and HIGH that are evenly divisible by four but not by five.

Expert's answer

import java.util.Scanner;




public class Test {

public static void main(String[] args) {

Scanner console = new Scanner(System.in);

System.out.println("Enter LOW range");

String temp = console.next();

int low = Integer.parseInt(temp);

System.out.println("Enter HIGH range");

temp = console.next();

int high = Integer.parseInt(temp);




for (int i = low; i < high; i++) {

if (i % 4 == 0 && i % 5 != 0) {

System.out.print(i + " ");

}

}

}

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS