2진법1 [알고리즘] 10진수 → 2진수 변환 //10진수 -> 2진수 int quotient = 3; ArrayList list = new ArrayList(); while(quotient > 0) { //나머지값 계산후 입력 int remainder = quotient % 2; list.add(remainder); quotient /= 2; } //역순 출력 for(int i = list.size()-1;i>=0;i--) System.out.print(list.get(i)); //결과 : 11 2020. 10. 16. 이전 1 다음