Create a program that will input a positive integer from the user. The program should check to

Question:

Create a program that will input a positive integer from the user. The program should check to make sure the entry is a positive integer and then check to see if the number is a prime number. A prime number is a number that is divisible only by itself and 1. The first five prime numbers are 2, 3, 5, 7, and 11; you can check this directly from the definition. If the number is prime, the program should display a message to this effect. If the number is not prime, the program should display the number and its factors. For example, if the user enters the number 3, the output should be:

The number 3 is a prime number.

However, if the user enters the number 6, the output should be:

The number 6 is not a prime number.

The factors of 6 are: 1, 2, 3, 6

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Prelude To Programming

ISBN: 9780133741636

6th Edition

Authors: Stewart Venit, Elizabeth Drake

Question Posted: