Advertisement
carsit

Untitled

Aug 31st, 2014
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int n,s,c,t;
  7. char p;
  8. cout << "Scomposizione in fattore primi";
  9. do{
  10. cout <<"\n\nInserire il numero da scomporre ";
  11. cin >>n;
  12. c=n; s=1;
  13. while (c!=1) {
  14. s++;
  15. while (c%s==0) {
  16. c=c/s;
  17. t=c*s;
  18. cout<<s<<endl;
  19. }
  20. }cout << "\n\nVuoi continuare? (S/N) ";
  21. cin >> p;
  22. } while (p != 'N');
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement