Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- ifstream f("Numere.in");
- ofstream g("Rezultate.out");
- void descompunere(int x) {
- int d = 2, p;
- while (x > 1) {
- p = 0;
- while (!(x % d)) {
- p++;
- x /= d;
- }
- if (p)
- g << d << ' ' << p << endl;
- d++;
- }
- }
- int main() {
- int y, x; bool q;
- f >> y;
- while (f >> x) {
- q = 1;
- for (int i = 2; q; i++)
- if (!(x % i))
- q = 0;
- if (!q)
- break;
- }
- cout << x;
- descompunere(y);
- cout << endl;
- system("pause");
- f.close();
- g.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement