I just wanted help getting started, anyway I found some help on another site and came up with this code:
Code:
#include <iostream>
using namespace std;
int main()
{
int n;
int i;
int c=0;
cout<<"enter a number:";
cin>>n;
for(i=1;i<=n;i++) // below is the statements to test for a prime number
{
if(n%i==0)
{
c += 1;
}
}//end of for
if(c==2)
{
cout<<n<<" is a prime number";
}//end of if
else
{
cout<<n<<" is a composite number it's factors are";
for(int k=1; k< n;k++)
{
if(n%k==0)
{
cout<<","<<k;
}//end of if
}//end of for
}//end of else
return 0;
}// end of mainA