Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int function2 (int a, int i, int p)
- {
- while (a%i==0)
- {
- a/=i;
- p++;
- function2(a, i, p);
- }
- return p;
- }
- int main ()
- {
- int a=0, c=0, p=0, x=1;
- cin >> a;
- c=a;
- int arr[c-1];
- for (int j=0; j<c-1; j++)
- arr[j]=0;
- for (int j=0; j<c-1; j++)
- {
- if (a%(j+2)==0)
- {
- x=function2(a,j+2,p);
- arr[j] = pow(j+2, x);
- a/=pow(j+2, x);
- }
- p=0;
- }
- for (int i=0; i<c-1; i++)
- if (arr[i]!=0)
- cout << arr[i] << " ";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement