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;
- num2 = 1;
- if (input==0){
- cout << input << " is neither a prime number nor a composite number . . .";
- }
- else if (input!=0){
- while (num2<=input){
- //Reset to 0
- two_numbers=0;
- while (num2<=input){
- if (input%num2==0){
- two_numbers++;
- }
- num2++;
- }
- if (two_numbers==2){
- cout << input << " is a prime number . . .";
- }
- else if (two_numbers!=2){
- cout << input << " is a composite number . . .";
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement