๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
SWEA

[SWEA] 1933. ๊ฐ„๋‹จํ•œ N์˜ ์•ฝ์ˆ˜

by JulesJ 2022. 5. 19.
728x90

1933. ๊ฐ„๋‹จํ•œ N์˜ ์•ฝ์ˆ˜ - D1

 

์•ฝ์ˆ˜์˜ ๊ฐœ๋…์„ ์ด์šฉํ•œ๋‹ค.

์•ฝ์ˆ˜๋Š” N์„ ์–ด๋–ค ์ˆ˜๋กœ ๋‚˜๋ˆด์„ ๋•Œ ๋‚˜๋จธ์ง€๊ฐ€ 0์ธ ๊ฒƒ์ด๋‹ค.

 

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 + " ");
			}
		}
	}
}

 

 

๋ ๐Ÿง

๋Œ“๊ธ€