#include<stdio.h>int main(){ int a; register int i=31,temp; printf("In this system the size of int is:%d",sizeof(int)); printf("\nPlease enter a integer\n"); scanf("%d",&a); getchar(); printf("the bits are :\n"); if(sizeof(a)!=4) { a=(long int)a;//long 应该在所以系统中都是4个字节的吧。 } for(i=31;i>=0;i--) { temp=a>>i; temp&=1; printf("%d ",temp); } getchar(); }下面的是可以输出哪些位是1(刚忘记看蝈蝈的要求了)#include<stdio.h>int main(){ int a; int one[32]={}; register int i=31,j=0,temp; printf("In this system the size of int is:%d",sizeof(int)); printf("\nPlease enter a integer\n"); scanf("%d",&a); getchar(); printf("the bits are :\n"); if(sizeof(a)!=4) { a=(long int)a;//long 应该在所以系统中都是4个字节的吧。 } for(i=31;i>=0;i--) { temp=a>>i; temp&=1; printf("%d ",temp); if(temp==1)one[j++]=32-i; } printf("\nthe bits which is one:\n"); for(i=0;i<j;i++) printf("%d ",one[i]); getchar(); }