1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | //Binary To Decimal Conversion Psuedo Code scanf("%d", &dec); //dec : Decimal while(dec > 0) { num[carry] = dec % 2; //num : Allocation memory space to conversion carry++; //carry : Move to next Binary position dec = dec/2 } for(int bin = carry - 1; bin >= 0; bin--) //bin = Binary, printing reverse { printf("%d", num[bin]); } | cs |
10진->2진 진법 변환.
의사 코드라기보단 그냥 변수 선언 없는 C 코드가 된 느낌이긴 한데...
어라 이제보니 첫줄 2진->10진으로 잘못썼네