Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<limits.h>
- void dectobin(unsigned short a);
- int main(void)
- {
- unsigned short a;
- printf("od 0 do %d: ",USHRT_MAX);
- scanf("%hu",&a);
- printf("%hu to diesietna(10)\n",a);
- dectobin(a);
- printf("to wynik dwojkowo\n");
- return 0; }
- void dectobin(unsigned short a)
- {
- int licznik;
- licznik=(CHAR_BIT)*sizeof(a);
- while(--licznik>=0)
- putchar(((a>>licznik)&1)? '1' : '0');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement