Actually this program is used for factors...
public class testloop2
{
//Andrew Loomis 01-23-03
//Project Name: test-loop-2
//This program is designed to find the factors from one to any positive
//integer (n).
public static void main(String args[])
throws java.io.IOException
{
EasyReader Keyboard = new EasyReader();
int n;
char again;
System.out.print("This program is designed to find the factors ");
System.out.print("\\nfrom one up to and including a positive integer (n). ");
do
{
System.out.print("\\n\\nFind the factors from 1 to ");
n = Keyboard.readInt();
while (n <= 0)
{
System.out.print("\\nPlease enter a positive non-zero integer: ");
n = Keyboard.readInt();
}
System.out.print("\\n");
for (int i = 1; i <= n; i++)
if (n % i == 0)
System.out.print(i + ", ");
System.out.print("\\n\\nWould you like to use this program again? ");
again = Keyboard.readChar();
Keyboard.readLine();
}
while ((again == \'Y\') || (again == \'y\'));
System.out.print("\\n\\nThank you for using my program.");
}
}