Advertisement
Guest User

Untitled

a guest
Oct 19th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. package scomposizione;
  2.  
  3. /**
  4. *
  5. * @author PC16
  6. */
  7. public class Scomposizione {
  8.  
  9. /**
  10. * @param args the command line arguments
  11. */
  12. public static void main(String[] args) {
  13. System.out.println("Grazie a questo programma potrai scomporre un numero in fattori primi");
  14. System.out.println("Inserisci un valore da scomporre:");
  15.  
  16. int i;
  17.  
  18. i = Console.leggiInt();
  19.  
  20.  
  21. for (int j = 2; j <= i; i++){
  22. if (i % j == 0)
  23. System.out.println(j);
  24. i = i/j;
  25. j=1;
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement