Results 1 to 3 of 3
  1. #1
    Happypanda is offline Member
    Join Date
    Jun 2012
    Posts
    7
    Rep Power
    0

    Smile Printing 30 prime numbers after 500000.

    Java Code:
    public class JNemesis
    {
    	public static void main(String[] Me)
    	{
    		int x,y;
    		y > 50;
    		for ( x = 0; x < 50; x++ )
    		{
    		            if ( y % x == 0 )
    		                     System.out.println(x);
            }
        }
    }
    I have to use either a for or while loop. any help will be highly appreciated. Thank you in advance.

  2. #2
    jfabian is offline Member
    Join Date
    Jun 2012
    Posts
    22
    Rep Power
    0

    Default Re: Printing 30 prime numbers after 500000.

    Happypanda, you have a lot of mistakes there, you need to read some java basics. Anyhow heres an example

    PrimeNumber.java

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Printing 30 prime numbers after 500000.

    Quote Originally Posted by Happypanda View Post
    I have to use either a for or while loop. any help will be highly appreciated. Thank you in advance.
    Help with what? You don't say what's wrong.

Similar Threads

  1. generating prime numbers...using an array
    By yingyang69 in forum New To Java
    Replies: 7
    Last Post: 03-01-2011, 05:30 AM
  2. Prime Number - System print all the prime numbers ...
    By pinkdreammsss in forum New To Java
    Replies: 20
    Last Post: 04-26-2009, 01:50 AM
  3. prime numbers program
    By i contra i in forum New To Java
    Replies: 9
    Last Post: 01-15-2009, 07:22 AM
  4. Prime numbers
    By tercius in forum New To Java
    Replies: 3
    Last Post: 05-04-2008, 06:05 AM
  5. Prime numbers
    By gapper in forum New To Java
    Replies: 3
    Last Post: 02-07-2008, 10:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •