Guest User

Untitled

a guest
Apr 22nd, 2020
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4.     unsigned char cur;
  5.     int counter = 0;
  6.     printf("0000000000000000");
  7.     while (true)
  8.     {
  9.         cur = getc(stdin);
  10.         if (feof(stdin))
  11.         {
  12.             break;
  13.         }
  14.         if (counter % 8 == 0)
  15.             putc(' ', stdout);
  16.         if (counter % 4 == 0)
  17.             putc(' ', stdout);
  18.         if (counter % 2 == 0)
  19.             putc(' ', stdout);
  20.         putc(' ', stdout);
  21.         printf("%x%x", cur / 16, cur % 16);
  22.         counter++;
  23.         if (counter % 16 == 0)
  24.         {
  25.             printf("\n%016x", counter);
  26.         }
  27.     }
  28.     if (counter % 16 != 0)
  29.     {
  30.         printf("\n%016x", counter);
  31.     }
  32.     putc('\n', stdout);
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment