CIS 71 (section 1): Homework 4

Handed out: 2/11/97
Due: by 2:30pm on 2/18/97
Email program to btrianta@thunder.temple.edu

Write a program that prompts the user to enter a positive integer, say X, and then prints out either:

X is a prime
or
X is not a prime and its factors are ...
where the ... are replaced by the factors of X, including 1 and X itself, printed on new lines.

Your main program should prompt the user and read X. Then it should call a function, say checkPrime, that will do the work on X printing the appropriate statements.

As a separate document that you will submit to the TA, you should do a case analysis for this problem: problem statement, analysis, design, implementation, and testing.

Here are two sample runs of your program:


Enter value of X > 30
30 is not a prime and its factors are: 
	 1
	 2
	 3
	 5
	 6
        10
	15
	30

Enter value of X > 17
17 is a prime