import javax.swing.*;
class prime4
{    public static String prime(int n1,int n2)
     {
	 int i,j;
     String s=" ";
     for(i=n1;i<=n2;i++)
     {for(j=2;j<i && (i%j)!=0;j++) {}
     if(i==j) {s+=i+"\n";}
	 }
	 return s;
     }	     
      public static void main(String args[])
      {    
           int n1=Integer.parseInt(JOptionPane.showInputDialog("enter first number  : "));
           int n2=Integer.parseInt(JOptionPane.showInputDialog("enter second number : "));                    
           JOptionPane.showMessageDialog(null,prime(n1,n2),"Prime numbers between "+n1+" and "+n2,JOptionPane.PLAIN_MESSAGE);         
     }
 }
