函数还是要用的吧?比如printf!
#include "stdio.h"
int main(void){
int n,i,k;
unsigned m,f;
printf("Input an integer...\n");
scanf("%d",&n);
printf("%d(10) = ",n);
m=(unsigned)n;
f=0x80000000;
while(f){
for(k=i=0;i<4;(k*=2)+=(m&f || 0),f>>=1,i++);
printf("%1X",k);
}
printf("(16)\n");
return 0;
}
不用数组好像不行