Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int num2, two_numbers, input;
- cout << "Enter a Number: ";
- cin >> input;
- for (input; num2<=input;){
- //Reset to 0
- two_numbers=0;
- for (num2=1; num2<=input; num2++){
- if (input%num2==0){
- two_numbers++;
- }
- }
- if (two_numbers==2){
- cout << input << " is a prime number . . .";
- }
- else if (two_numbers!=2 && two_numbers!=0){
- cout << input << " is a composite number . . .";
- }
- else if (two_numbers==0){
- cout << input << " is neither a prime number nor a composite number . . .";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement