Guest User

Untitled

a guest
Feb 21st, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3.  
  4. main(){
  5.  
  6. char hex[8];
  7. int i,num;
  8. int dec = 0;
  9. int a;
  10.  
  11. for(i = 0; i <= 7; i++){
  12. scanf ("%c", hex[i]);
  13. if(hex[i] == 'A') num = 10;
  14. if(hex[i] == 'B') num = 11;
  15. if(hex[i] == 'C') num = 12;
  16. if(hex[i] == 'D') num = 13;
  17. if(hex[i] == 'E') num = 14;
  18. if(hex[i] == 'F') num = 15;
  19. else num = hex[i]%30;
  20. for(a = 7; a >= 0; a--) dec = num*(16^a);
  21. }
  22. printf("%d \n", dec);
  23. system ("pause");
  24. }
Add Comment
Please, Sign In to add comment