Results 1 to 3 of 3

Thread: Prime Numbers!!!

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    1

    Prime Numbers!!!

    Write a program that asks a user to enter a number (number can be negative, positive, or zero), and then displays all prime numbers from zero to this number (for this project prime numbers can be positive and negative), and the product of all these prime number (must specify how many prime numbers are in the product)

    The program must check for incorrect input, and have an EXIT button.
    The form will have one text box, one button, and one list box.

    I can not figure out the formula for prime numbers.

    Any help will be greatly appreciated

  2. #2
    Fanatic Member Ruku's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    655

    Re: Prime Numbers!!!

    Allright,

    There's a function called Mod, which returns a value depending if the value of the number is "dividable" by X...

    Exemple:

    10 Mod 2 = 1
    9 Mod 3 = 1

    9 Mod 2 = 0
    10 Mod 3 = 0

    Get it?

    Well, I guess you can figure out the rest by your self...

    InputBox stuff or textbox with buttons...

    Still got a problem? Post again!

    Originally posted by Searcher
    Write a program that asks a user to enter a number (number can be negative, positive, or zero), and then displays all prime numbers from zero to this number (for this project prime numbers can be positive and negative), and the product of all these prime number (must specify how many prime numbers are in the product)

    The program must check for incorrect input, and have an EXIT button.
    The form will have one text box, one button, and one list box.

    I can not figure out the formula for prime numbers.

    Any help will be greatly appreciated

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    This may be of some assistance...

    http://www.freevbcode.com/ShowCode.Asp?ID=1201

Posting Permissions

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



Click Here to Expand Forum to Full Width