Advertisement
kingasen

Untitled

Nov 20th, 2021
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Arrays;
  4. import java.util.Scanner;
  5.  
  6. public class Main {
  7.  
  8. public static void main(String[] args) {
  9. int i,count;
  10. Scanner sc=new Scanner(System.in);
  11. int n=sc.nextInt();
  12. for(int j=0;j<=n;j++)
  13. {
  14. count=0;
  15. for(i=1;i<=j;i++)
  16. {
  17. if(j%i==0)
  18. {
  19. count++;
  20. }
  21. }
  22. if(count==2)
  23. System.out.print(j+" ");
  24. }
  25. }
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement