杭电-------2051Bitset(C语言)

#include<stdio.h>
int a[1000] = { 0 };
int main() {
    int m;
    int i, j = 0;
    while (~scanf("%d", &m)) {
        while (m) {
            a[j++] = m % 2;
            m = m / 2;
        }
        for (i = j - 1; i >= 0; i--) {
            printf("%d", a[i]);
        }
        printf("\n");
        j = 0;
    }
    return 0;
}

 

posted @ 2018-02-03 20:28  Carol淋  阅读(142)  评论(0编辑  收藏  举报