Ok, I'm working on a problem for my Java class and I have no idea what the hell I am doing. I am supposed to write a program that will make the user enter in an integer, and it will then print a list of all the prime integers less than or equal to the user's input. I am supposed to use a for loop, and I can't use any created methods. Keep in mind I'm a total idiot with this stuff, so maybe my terms aren't the best. Anyway, he gave us an example using a created method. Here it is:
public class PrintPrimes {
public static void main(String[ ] args) {
int x;
Scanner input = new Scanner(System.in);
System.out.println("Please enter a positive integer");
x = input.nextInt( );
System.out.println(
"The prime numbers less than or equal to " + x + " are ");
for (int i=2; i
public class PrintPrimes {
public static void main(String[ ] args) {
int x;
Scanner input = new Scanner(System.in);
System.out.println("Please enter a positive integer");
x = input.nextInt( );
System.out.println(
"The prime numbers less than or equal to " + x + " are ");
for (int i=2; i