728x90

풀이)

import java.util.Scanner;
import java.io.FileInputStream;
 

class Solution
{
    public static void main(String args[]) throws Exception
    {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
 
       for(int i=1; i<=N; i++){
            if(N%i==0){
                System.out.print(i + " ");
            }
        }
    }
}
728x90