#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; }
#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; }
转载于:https://www.cnblogs.com/lin0/p/8410648.html