//--------------------------------------------------------------------------- //15Àå µµÀü2 #include #include int trans_binary(int *a, char b[]); void ReverseIndex(char *InNum, int *ArSize, char a[]); //------------------------------------------------------------------------------ int main() { int i, Num; char TheRest[50]; int Array_Size = 0; printf("¼ýÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä : "); scanf("%d", &Num); Array_Size = trans_binary(&Num, TheRest); printf("¹è¿­ÀÇ Å©±â´Â %d ÀÔ´Ï´Ù. ", Array_Size); ReverseIndex(&Num, &Array_Size, TheRest); system("pause"); return 0; } //------------------------------------------------------------------------------ int trans_binary(int *a, char b[]) { int i, ArraySize; char temp = *a; for(i=0; temp != 0; i++) { b[i] = temp%2; temp /= 2; } ArraySize = i+1; return ArraySize; // ReverseIndex(, &ArraySize, b); } //------------------------------------------------------------------------------ void ReverseIndex(char *InNum, int *ArSize, char a[]) { int i; char buf; int Size = *ArSize; for(i=0; i<(Size/2); i++) { buf = a[i]; a[i] = a[Size-i-1]; a[Size-i-1] = buf; } printf("ÀÔ·ÂÇÑ ¼ö %d ÀÇ 2Áø¼ö °ªÀº ", *InNum); for(i=0; i