Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int n,s,c,t;
- char p;
- cout << "Scomposizione in fattore primi";
- do{
- cout <<"\n\nInserire il numero da scomporre ";
- cin >>n;
- c=n; s=1;
- while (c!=1) {
- s++;
- while (c%s==0) {
- c=c/s;
- t=c*s;
- cout<<s<<endl;
- }
- }cout << "\n\nVuoi continuare? (S/N) ";
- cin >> p;
- } while (p != 'N');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement