hoe do i write a c++ program that takes an integer as input and displays the number as either prime number or not.

#include<iostream.h>
#include<conio.h>
        void main()
        {
         //clrscr();
         int number,count=0;
         cout<<"ENTER NUMBER TO CHECK IT IS PRIME OR NOT ";
          cin>>number;
           for(int a=1;a<=number;a++)
               {
                if(number%a==0)
                   {
                  count++;
                   }
               }
       if(count==2)
         {
          cout<<" PRIME NUMBER \n";
         }
       else
         {
          cout<<" NOT A PRIME NUMBER \n";
         }
       //getch();
       }
commented: Good job giving away homework solutions. :rolleyes: -3
commented: baburajan, the terms of service for these forums do NOT allow us to solve homework problems directly. Please DON'T do this again! -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.