Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- typedef struct
- {
- int f, put;
- } ELEM;
- int main()
- {
- ELEM e[1000];
- int x, n = 0;
- cout << "x=";
- cin >> x;
- int f = 2, p;
- while (x > 1)
- {
- p = 0;
- while (x % f == 0)
- {
- p++;
- x /= f;
- }
- if (p)
- {
- e[n].f = f;
- e[n].put = p;
- n++;
- }
- f++;
- }
- for (int i = 0; i < n; i++)
- cout << "factoru " << e[i].f << " la puterea " << e[i].put << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement