Tuesday, December 7, 2021

 #include <iostream>

using namespace std;
int main()
{
    int num, i, j, count = 0;
    cout << "enter the positive whole number you want to check" << endl;
    cin >> num;
    if (num == 1)
    {
        cout << "number 1 is neither prime nor composite" << endl;
    }
    else if (num == 0 || num < 0)
    {
        cout << "number is either zero or negative" << endl;
    }
    else if (num > 1)
    {
        for (i = 1; i <= num; i++)
        {
            if (num % i == 0)
            {
                cout<< i << "," ;

                count++;
                        }
        }
        cout<<" are the numbers "<<num <<" is divisible by"<<endl;
        if (count == 2)
        {
            cout<<endl << num << " is prime" << endl;
        }
        else if (count > 2)
        {
            cout <<endl << num << "  is not prime" << endl;
        }
    }

    return 0;
}

No comments:

Software scope

 In software engineering, the software scope refers to the boundaries and limitations of a software project. It defines what the software wi...

Popular Posts