Banner

My Tech Blog (2์ง„์ˆ˜)

โœ… ๋ฌธ์ œ๋ฌธ์ž์—ด ํ˜•ํƒœ์˜ 2์ง„์ˆ˜๋ฅผ ์ž…๋ ฅ๋ฐ›์•„ 10์ง„์ˆ˜๋กœ ๋ฐ”๊พธ๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. โœ… ์ฝ”๋“œimport java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.next(); int base = 1; int result = 0; for (int i = str.length()-1 ; i >= 0; i--) { if(str.charAt(i) == '1'){ result += base; } ..
โœ… ๋ฌธ์ œ10์ง„์ˆ˜ ์ •์ˆ˜๋ฅผ ์ž…๋ ฅ ๋ฐ›์•„ 2์ง„์ˆ˜๋กœ ๋ณ€ํ™˜ํ•ด์„œ ์ถœ๋ ฅํ•˜์‹œ์˜ค. โœ… ์ฝ”๋“œimport java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num = sc.nextInt(); int[] leejin = new int[20]; for (int i = 0; i = 0; i--){ System.out.print(leejin[i]); } }}โœ… ์ถ”๋ก  ๊ณผ์ •์‹ญ์ง„์ˆ˜๋ฅผ ์ด์ง„์ˆ˜๋กœ ๋งŒ๋“ค์–ด์ฃผ๋ ค๋ฉด 2๋กœ ๋‚˜๋ˆˆ ๋‚˜๋จธ์ง€๋ฅผ ํ™œ์šฉํ•ด์ฃผ๋ฉด ๋œ๋‹ค.์‹ญ์ง„์ˆ˜๋ฅผ 2๋กœ ๋‚˜๋ˆˆ ๋‚˜๋จธ์ง€๋ฅผ ๊ณ„์†ํ•ด์„œ ๊ตฌํ•ด์„œ,..
์ธ์ ˆ๋ฏธ์˜€๋˜๊ฒƒ
'2์ง„์ˆ˜' ํƒœ๊ทธ์˜ ๊ธ€ ๋ชฉ๋ก
์ƒ๋‹จ์œผ๋กœ