Thread: for loop to find prime numbers

  1. #1
    Registered User
    Join Date
    Mar 2006
    Hello everyone! I'm truly in a squeeze that I dyerly need help on!

    I need a program that prints the prime numbers that are there between two given positve integers(The first integer is less than the second.). In other words, the program should accept two positive integers from the keyboard(i.e. from user during runtime.) as input and display all prime numbers(in an order) between these two integers.
    Ex. If the input is 3 and 13 then the program should display 5, 7, 11

    Can sombody please help???

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Split from
    Next time, read the board rules.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    for ever odd from low to high
        test for prime
    You do the rest.

    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Prime numbers
    By Imbellis in forum C Programming
    Replies: 25
    Last Post: 11-27-2008, 06:37 AM
  2. Logical errors with seach function
    By Taka in forum C Programming
    Replies: 4
    Last Post: 09-18-2006, 05:20 AM
  3. prime numbers re-posted
    By crypto_quixote in forum C Programming
    Replies: 3
    Last Post: 01-17-2006, 08:44 PM
  4. printing only prime numbers
    By Micko in forum C Programming
    Replies: 30
    Last Post: 06-10-2004, 10:23 PM
  5. Prime Numbers
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 09-24-2001, 07:11 PM