标签:
这是个很简单代码,我直接黏上去
int main(int argc, const char * argv[]) { int num = 0; int y = 0; int tow[20]; printf("请输入一个十进制的数:"); scanf("%d",&num); while (num !=0) { tow[y] = num % 2; num = num / 2; y++; } for (; y>0; y--) { printf("二进制为:%d",tow[y-1]); } return 0; }
标签:
原文地址:http://www.cnblogs.com/yyns/p/4934893.html