Advertisement
jakaria_hossain

HexaDecimal to Decimal

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