#include <stdio.h>
void printBinary(int a){
if (a<0) { printf("1"); }else { printf("0"); }
int count=30; int temp=0; while (count>=0) { temp=a>>count&1;
printf("%d",temp); if (count%8==0) { printf(" "); } count--; } printf("\n"); } int main() { int a=0; scanf("%d",&a); printBinary(a); }
|
|