import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Main {
    public static void main(String[] args) {
       // System.out.println("Hello world!");
                
                /*Finds the factors of a given number and the total count of the factors*/
                
                    /*Scanner scn = new Scanner(System.in);
       
                        int n = scn.nextInt();
                        int count = 0;
                        for(int i=1; i<=n; i++){
                        if(n%i==0){
                            System.out.print(i + " ");
                            count++;
                            }
                    }
                        System.out.print(n + " are the factors of number: ");
                        System.out.println(" ");
                        System.out.println("The total count of factors for number: " + n + " are " + count);
            */
            
            /*Whether a number is a Prime number or not*/ 
            
                    /*Scanner scn = new Scanner(System.in);
                    int n = scn.nextInt();
                    int count = 0;
                    for(int i=1; i<=n; i++){
                        if(n%i==0){
                            count++;
                        }
                        if(count>2){
                        break;
                    }
                }
                
                if(count==2){
                    System.out.println(n + " is a prime number");
                    }
                else {
                System.out.println(n + " is not a prime number");
                }*/
                    
            
                /*Scanner scn = new Scanner(System.in);
                int a = scn.nextInt();
                int b = scn.nextInt();
                int hcf =1;
                int min =0;
                    
                    if(a>b){
                        min=b;
                    }
                    else{
                        min=a;
                    }
                    for(int i=1;i<=min;i++){
                        if(a%i==0 && b%i==0){
                        hcf=i;    
                        System.out.println(hcf);
                    }
                }*/
                
                /*Print all number except the number which are part of the input value*/
                     
                     /*Scanner scn = new Scanner(System.in);

                    int a = scn.nextInt();
                    int b = scn.nextInt();
                    int x = scn.nextInt();
                    int y = scn.nextInt();

                    int max =0;
                    if(a>b){
                        max=a;
                }
                    else{
                        max=b;
                }
                    for(int i=1;i<=max;i++){
                    if(i==x || i==y){
                        continue;
                }System.out.print(i + " ");
            }*/   
            
            /*Whether a number is a prime number or not*/
            
                /*Scanner scn = new Scanner(System.in);
                        
                    int a = scn.nextInt();
                    int count = 0;
            
                for(int i=1;i<=a;i++){
                    if(a%i==0){
                        count++;
                    }
                }    
                    if(count==1){
                        System.out.println(a + " is a Composite Number.");
                    }
                    else if(count>2){
                        System.out.println(a + " is Not a Prime Number.");
                    }
                    else if(count==2){
                        System.out.println(a + " is a Prime Number.");
                    }*/
                    
                /*For T cases, find the sum of the numbers of each T cases*/
                
                    /*Scanner scn = new Scanner(System.in);
                
                        int T = scn.nextInt();
                        
                        for(int i=0; i<T;i++){
                        int sum=0;
                        int N= scn.nextInt();    
                            while(N>0){
                            int rem = N%10;
                            N= N/10;
                            sum= sum+rem;
                        }
                        
                        System.out.println(sum); 
                        }*/
                        
                
                /*For T number of test case inputs, find whether given number is a perfect number or not*/
                
                       /* Scanner scn = new Scanner(System.in);
                        int t = scn.nextInt();
                        int sum = 0;
                        //int j =;
                            
                            for(int i=1;i<t;i++){
                            int n = scn.nextInt();
                        
                                while(n%i==0){
                                sum= sum+i;
                
                    }
                       if(n==sum){
                            System.out.println("Yes");
                        }
                        else {
                                System.out.println("No");
                            
                    }
                }         */  
                
                /*The above code not returning any answer and is incorrect syntax 
                The below given code is correct and returning the correct value*/
                        
             /*           Scanner scn = new Scanner(System.in);
                            int t = scn.nextInt();

                            for (int i = 0; i < t; i++) {
                            int n = scn.nextInt();
                            int sum = 0;

                            for (int j = 1; j < n; j++) {
                            if (n % j == 0) {
                            sum += j;
                }
            }

                            if (n == sum) {
                                System.out.println("YES");
                    }        else {
                            System.out.println("NO");
                }
            }*/
                            
             /*Take input for N numbers and print all the prime number from 1 to N*/
                            
                            Scanner scn = new Scanner(System.in);
                            
                            int N = scn.nextInt();
                            
                            for(int i=1;i<N;i++){
                                
                                if(N%i==0){
                                    int count = 0;
                                    continue;
                                    count = count+i;
                                }
                                if (count>=2){
                                    System.out.print(count + " ");
                                }
                            }
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                    
                    
                    
                    
    }       
}       

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: