import javax.swing.JOptionPane;

public class H6OefT4
{
	public static void main (String [] args)
	{
		int kleinste, grootste;
		String result = "";

		kleinste = Integer.parseInt(JOptionPane.showInputDialog("Geef de kleinste waarde: "));
		grootste = Integer.parseInt(JOptionPane.showInputDialog("Geef de grootste waarde: "));

		for (int i=kleinste;i <= grootste;i++)
		 {	if (perfect(i))
				result += i + "\n";
	  	 }

		JOptionPane.showMessageDialog(null,result);

		System.exit(0);
	}


	static boolean perfect( int x)
	{	if (x==somVanDelers(x))
			return true;
		else return false;
	}

	static int somVanDelers (int y)
	{ 	int som = 1;

		for (int i=2; i<= y/2;i++)
			if (y%i == 0)
				som +=i;

		return som;
	}


}