This works and shows the factors or tells if the number is a prime number but doesn't show ODD factors please help!! I need to turn this tomorrow
#include <iostream>
using namespace std;
int prime(int num);
int main()
{
int num;
cout<<"Enter number: ";
cin>>num;
if(prime(num)==1)
cout<<"The number is prime";
else
{
cout<<"The number is not prime, factors are\n1\n";
if( num%2==0)
for(int j=2;j<num;j+=2)
{
if(num%j==0)
cout<<j<<endl;
}
for( int n=num;n<=num;n/=2)
{
if(num%n==0)
cout<<n<<endl;
}
for(int m=3;m<num;m+=3)
{
if(num%m==0)
cout<<m<<endl;
}
}
}
int prime(int num)
{
if(num <= 1)
{
return false;
}
if(num == 2)
{
return true;
}
if ( num%2 == 0)
{
return false;
}
for (int n=3;n*n <= num;n+=2)
{ if (num%n == 0)
return false;
}
return true;
}