Advertisement
Momir

Untitled

May 24th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     char str[99999];
  7.     int i = 0, b = 0;
  8.     short niz[99999];
  9.  
  10.     fflush(stdin);
  11.  
  12.     do
  13.     {
  14.         scanf("%c", &str[i]);
  15.         i++;
  16.     }
  17.     while(str[i - 1] != '\n');
  18.  
  19.     for(int j = 0; j < i; j++)
  20.     {
  21.  
  22.         for(int c = 7; c >= 0; c--)
  23.         {
  24.             if ((str[j] >> c) & 1)
  25.                 niz[b] = 1;
  26.             else
  27.                 niz[b] = 0;
  28.  
  29.            b++;
  30.         }
  31.     }
  32.  
  33.     printf("\n");
  34.  
  35.     for(int x = 0; x < b - 8; x++)
  36.         printf("%d", niz[x]);
  37.  
  38. //    for(int x = 0; x < i-1; x++)
  39. //        printf("%d", str[x]);
  40.  
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement