- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
#include <conio.h>
#include <stdio.h>
const int SIZE = 33;
void DecToBin (unsigned int num, char *bin)
{
int i,j;
char tmp[SIZE];
for(i=0; num; num>>=1, i++)
tmp[i] = (num&1)?('1'):('0');
for(j=0; j<i; j++)
bin[j] = tmp[i-j-1];
bin[j]='\0';
}
unsigned int shl(unsigned int num, int shift)
{
return (num << shift) | (num >> 32 - shift);
}
void main()
{
int n, m;
scanf("%d", &n);
char bin[SIZE];
DecToBin(n,bin);
printf("%s\n", bin);
m = shl(n, 35);
DecToBin(m,bin);
printf("%s\n", bin);
_getch();
}