Prime or not - Insurance Tips

A Hub of Best Guide Health Insurance Tips

Saturday, March 28, 2020

Prime or not

#include
#include

using namespace std;

int main()
{
    int num, count=0;
    cout<<"Enter a number :";
    cin>>num;

    for(int i=2; i    {
            if(num%i==0)
            {
             count++;
             break;
            }
    }
    if(count==0)
    cout<<"Prime number";
    else
    cout<<"Not a Prime number";
   
      getch();
}

No comments:

Post a Comment