Weighting = 3% (Executable solutions to the assignment can be found in Unix under /home/231/assignments/assignment4). The assignment must be completed on the Computer Science computers. You must hand in your submission via a printed typescript. For the assignment you must run the following inputs within your script session: 1, 100, 1000, 1001. You can run additional data to demonstrate any additional functions of your program but the above inputs are require for your submission. (Failure to run these values will result in the loss of a letter "step", e.g., from "A" to "A-", "A-" to "B+").
For further details please refer to the link on general assignment specifications.
(If you fulfill all assignment specifications listed here then the maximum grade that you can get is a "B"). For this version of the assignment you are to write a program that will prompt the user to input an integer between 2 and 1000. The program will then display all the factors of that number. A factor of a number will evenly divide into that number. You can view a more precise mathematical definition at the following link. The program will display only a maximum of 10 factors on a line (see Figure 1 below). After that succeeding factors will displayed on the next line. Also columns must be neatly formatted so that numbers in the same column are right justified.
Figure 1: Example output of the factors program.
(If you fulfill all assignment specifications then the maximum grade that you can get is a "A"). This version of the assignment will display the output in the fashion above however it will display only the prime factors for the number that the user inputs. Prime factors of a number are ones that are factors of the number but cannot be evenly divided by any other number (save 1 and itself). Prime factors start at the number 2 (not one). For example, the number 5 is prime because it's only factors are one and itself. The number six, however is not prime because it's factors (and not necessarily prime factors) include 1, 2, 3 and 6. Since some of it's factors are numbers other than 1 or itself six so it is not prime. For a more precise definition of a prime number please refer to the following link. (You might not want to code your assignment based on this definition though, it's included more for precision than a hint as to how to do the assignment...) In addition, the Mathematics department at Washington State provides an web form that allows you to determine all of the prime factors of a number.