#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
int number,div, num1;
int arr[20], i=0;
int result=0, large_no;
cout<<"Enter a number to know its prime factor: ";
cin>>number;
num1= number;
cout<<"\nThe prime factors of "<<number<<" are: \n\n";
div = 2;
while(number!=0)
{
if(number%div!=0)
div = div + 1;
else {
number = number / div;
cout<<div<<" ";
arr[i]= div;
i++;
if(number==1)
break;
}
}
large_no= arr[i-1];
cout<<endl;
cout<<"In this prime factorss.. "<<endl;
for(int j=2;j<=large_no;j++)
{
for(int k=0;k<=large_no;k++)
{
if(j==arr[k])
{
result=result+1;
}
}
cout<<j<<" comes "<< result<<" time "<<endl;
result=0;
}
system("pause");
}