rajeevs1992

Hexkey

Jul 19th, 2011
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.26 KB | None | 0 0
  1. int hexKey(char digit,int power)
  2. {
  3.     int arr[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15},i;
  4.     char digitList[]={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
  5.     for(i=0;i<16;i++)
  6.     {
  7.         if(digitList[i]==digit)
  8.             return arr[i]*pow(16,power);
  9.     }
  10. }
Advertisement
Add Comment
Please, Sign In to add comment