Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Arrays;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- int i,count;
- Scanner sc=new Scanner(System.in);
- int n=sc.nextInt();
- for(int j=0;j<=n;j++)
- {
- count=0;
- for(i=1;i<=j;i++)
- {
- if(j%i==0)
- {
- count++;
- }
- }
- if(count==2)
- System.out.print(j+" ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement