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!");
     
     
     /*What are the factors of a given number*/
     
        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++;
                    System.out.print(i + " " );
                }
                
           }
                System.out.print("are the different factors of the number " + n);
                System.out.println(" ");
                System.out.println(count + " is the total number of different factors that divides " + n);
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
           
    }
}

Embed on website

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