Advertisement
bbalint05

Untitled

Feb 24th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. public class Kisebbprim {
  2.  
  3. public static void main (String[] args) {
  4.  
  5. int n;
  6. n = (int)Math.round(Math.random()*100+100);
  7. System.out.println(n);
  8.  
  9. for (int i = 2; i <= n; i++) {
  10.  
  11. for (int j = 2; j <= i; j++) {
  12.  
  13. if (j == i) {
  14.  
  15. System.out.println(i);
  16. }
  17.  
  18. if (i % j == 0) {
  19.  
  20. break;
  21. }
  22. }
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement