package mert.com; public class prime { public static void main(String[] args) { for (int num=500; num<1000; num++) { boolean flag = false; for(int i=2; i<=num/2; i++) { if(num % i == 0) flag = true; } if (flag == false) System.out.println(num); } } }