Dev-san

Untitled

Oct 30th, 2014
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.26 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     char c;
  6.     int broj = 0, cifra;
  7.     while ((c = getchar()) != '\n')
  8.     {
  9.         if (c >= '0' && c <= '9')
  10.             cifra = c - '0';
  11.         else
  12.             cifra = c - 'A' + 10;
  13.         broj *= 16;
  14.         broj += cifra;
  15.     }
  16.     printf("%d", broj);
  17.  
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment