Prime numbers
This is what I have to do in C++ but I'm stuck on how to go about it.
In this exercise write a program that detects if the integer inputed by the user is a prime number or a composite number. If you have not heard of these terms before then a prime number is a number that can only be divided by itself and one. A composite number is a number that has 2 or more factors. A factor is a number that will divide evenly into a number.
If the number inputed by the user is a prime number then the program will output something similar to this
Enter An Integer: 13
Your number 13 is a prime number
If the number is a composite number then the program's output will be something like this
Enter An Integer: 24
Your number 24 is a composite number.
It's factors are 2, 3, 4 ,6, 8, 12
If you can complete this exercise without any difficulties then you can proceed to the next lesson. If you found that you had any problems with this exercise then contact your instructor about the problems and attach any working code so that we can discuss where your solutions lay.
|