Code Below:
import java.util.*;
class composite
{
public static void main()
{
Scanner s=new Scanner(System.in);
int x,y,i,j,c;
System.out.println("enter limits");
x=s.nextInt();
y=s.nextInt();
for(i=x;i<=y;i++)
{
c=0;
for(j=1;j<=i;j++)
{
if(i%j==0)
c++;
}
if(c>2)
System.out.println(i);
}
}
}