Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- #include<math.h>
- int main()
- {
- int d=0,i=0,j,s;
- char h[30], he[16]= {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
- scanf("%s", h);
- for(s=strlen(h)-1;s>=0;s--)
- {
- for(j=0;j<16;j++)
- {
- if(h[s]==he[j]) d=d+j*pow(16,i);
- }
- i++;
- }
- printf("%d", d);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement