[Java] 16. 배열 (10진수를 2, 8, 10, 16 진수로 변경하기)
package chap5; import java.util.Scanner; /* * 10진수를 2, 8, 10, 16 진수로 변경하기 */ public class ArrEx5 { public static void main(String[] args) { int[] digit = {2, 8, 10, 16}; char[] data = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; char[] arr; System.out.println("10진수 값을 입력하세요"); Scanner scan = new Scanner(System.in); int num = scan.nextInt(); int divnum = num, index = 0; //di..
2022. 3. 15.
[Java] 16. 배열 (10진수를 16진수로 변경하기)
package chap5; import java.util.Scanner; /* * 10진수를 16진수로 변경하기 */ public class Exam3 { public static void main(String[] args) { char[] data = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; char[] hex = new char[8]; System.out.println("10진수 값을 입력하세요"); Scanner scan = new Scanner(System.in); int num = scan.nextInt(); int divnum = num, index = 0; while(divnum >0) { hex[index++] ..
2022. 3. 15.