Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int gethex() {
- register int c;
- while ((c = getchar()) >= 0) {
- _gethex:
- if (c != '#') {
- c -= 48; // convert '0' - '9'
- if (c < 0) continue; // invalid, ignore
- if (c > 48) c -= 39; // convert 'a' - 'f'
- return c;
- }
- while ((c = getchar()) != '\n');
- goto _gethex;
- }
- exit(0);
- }
- int main() {
- register int hi,lo;
- while (1) {
- hi = gethex() << 4;
- lo = gethex();
- putchar(hi + lo);
- }
- }
Add Comment
Please, Sign In to add comment