
โ
๋ฌธ์ ์ ์ n์ ์
๋ ฅ๋ฐ์ 1, 2, 4, 7, 11๊ณผ ๊ฐ์ ์์ด์ n๋ฒ์งธ ํญ๊น์ง ์ถ๋ ฅํ์์ค. โ
์ฝ๋import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("n ์
๋ ฅ : "); int n = sc.nextInt(); int result = 1; for (int i = 0; i โ
์ถ๋ก ๊ณผ์ 1๋ถํฐ ์์ํด์ 1,2,3,4,5....์ฉ ๋ํด๊ฐ๋ฉฐ ์ซ์๋ฅผ ๋์ดํ๋ ๊ท์น์ด ์๋ค. ์ฒ์์ ์ ์ํ ํ์
์ result ๋ณ์๋ฅผ ์ ์ธํด์ฃผ๊ณ 1๋ก ์ด๊ธฐํ ํด์คฌ๋ค.0๋ถํฐ n๊น์ง for๋ฌธ์ ๋๋ ค๊ฐ๋ฉฐ i๋ฅผ 1์ฉ ์ฆ๊ฐ์์ผ์ค๋ค.์ด๊ฑธ..