#include<iostream>
using namespace std;
void P(int y);
int main()
{
int y;
cout<<"Enter an integer: ";
cin>>y;
cout<<"The Prime Factors of "<<y<<" are: ";
P(y);
}
void P(int y)
{
int m;
for(m=2;m<=y;m++)
{
if(y%m==0)
{
cout<<" "<<m;
P(y/m);
break;
}
}
}
Comments
Leave a comment