public class Main { public static void main(String[] args) { displayPrimeNumbers(); } public static boolean isPrime(int num) { if (num < 2) { return false; } for (int i = 2; i <= Math.sqrt(num); i++) { if (num % i == 0) { return false; } } return true; } public static void displayPrimeNumbers() { System.out.println("Prime numbers starts with 5:"); for (int i = 500; i < 600; i++) { if (String.valueOf(i).startsWith("5") && isPrime(i)) { System.out.print(i + " "); } } } }