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