Answer to Question #17131 in Java | JSP | JSF for Sayed Abdullah Almousawi

Question #17131
Write a Java application that prints the numbers between LOW and HIGH that are evenly divisible by four but not by five.
1
Expert's answer
2012-10-25T10:37:10-0400
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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS