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, n=1;
- cin >> a;
- c=a;
- int arr[2][c];
- for (int i=0; i<2; i++)
- for (int j=0; j<c-1; j++)
- arr[i][j]=0;
- for (int j=0; j<c-1; j++)
- {
- if (a%(j+2)==0)
- {
- arr[0][j]=j+2;
- arr[1][j]=function2(a,j+2,p);
- a/=pow(j+2, arr[1][j]);
- }
- p=0;
- }
- for (int i=0; i<2; i++)
- {
- for (int j=0; j<c-1; j++)
- {
- cout.width(3);
- if (arr[0][j]!=0)
- cout << arr[i][j] << " ";
- }
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement