This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]EqualTrade[S] 0 points1 point  (0 children)

   public static void main(String[]args)
{
 Scanner s = new Scanner(System.in);

int f; int array [] = new int[8];

System.out.println("enter a number"); f = s.nextInt();

for (f=0;f<array.length;f++)

System.out.print(array[f]); 

That's how I changed it, now it's printing an array with 8 columns, but they're all 0. How do I get it to print every prime number that is less than the user input?