~cpp #include <stdio.h> void jinsu_change(int, int); void main() { int ten_jinsu, any_jinbeob; while(1){ while(1) { printf("끝내려면 '0 0' 입력.n"); printf("5자리이하 10진수, 바꿀 진법 입력(ex: 55 2) : "); scanf("%d %d", &ten_jinsu, &any_jinbeob); if(any_jinbeob < 0 || any_jinbeob > 24){ printf("다시 입력해 주세요..."); }else{ break; } } if(ten_jinsu == 0) break; jinsu_change(ten_jinsu, any_jinbeob); } } void jinsu_change(int ten_jinsu, int any_jinbeob) { int temp[50] = {0, }; int temp_jinsu, turn = 0, i = 0; char match_Num[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L','M','N'}; temp_jinsu = ten_jinsu; do{ temp[i] = temp_jinsu % any_jinbeob; temp_jinsu = temp_jinsu/any_jinbeob; i++; turn++; }while(temp_jinsu >= any_jinbeob); temp[turn] = temp_jinsu; printf("10진수 : %d n진법 : %d n결과 : ", ten_jinsu, any_jinbeob); for(i = turn; i >= 0 ; i--) { printf("%c", match_Num[temp[i]]); } printf("n"); }