.. _hw6:

Homework 6 - Flow Control Program - Prime Numbers
===================================================================

An integer is a *prime* number if it is divisible only by 1 and itself.
For example, 2, 3, 7, and 11 are prime numbers.  Write a program that
reads an integer from the user and determines if it is a prime number.  If
it is not a prime number, print out the list of divisors.  You will likely
want to write some notes and plan of attack before writing the code for this
program.  Test your program with the numbers: 10, 0, 1, 2, 4, 9, 11 and 12.

.. Hint::

    Use the modulus operator % to determine if a number is divisable by
    another number.  You only need to test divisors up to :math:`\sqrt{n}`.
    In your program, you can express that as (``(int)sqrt((double)n)``).

.. Here is the code that we worked on in class on Oct. 18:
.. :download:`prime.c`.