#include <stdio.h> #include <stdlib.h> /* */ int main(int argc, char *argv[]) { int n,m,a,b; a=0b01000000000000000000000000000000; b=0b10000000000000000000000000000000; while(1) { scanf("%d",&n); if(b&n) { printf("1"); } else { printf("0"); } while(a!=0) { if(n&a) //如果写成if(n&a!=0) //则输出结果不对 { printf("1"); } else { printf("0"); } a=a>>1; } printf("\n"); a=0b01000000000000000000000000000000; } return 0; } |