Decimal to hex comvertion | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

Decimal to hex comvertion

want to convert number to hex like if number is 123456789012345 then hex should be like this 01 02 03 04 05 06 07 08 09 00 01 02 03 04 05

8th Nov 2016, 4:03 AM
MANPREET SINGH Virk
MANPREET SINGH Virk - avatar
4 Réponses
+ 2
divide the no by sixteen and ones digit will be first remainder again do and second is ten and third hundred and so on
8th Nov 2016, 4:20 AM
Sandeep Chatterjee
+ 2
example 12346. now divide it by 16 we get 771 as quotient and the remainder 10 so ones digit 10 now divide 771 we get 3 so 03 the tens digil now 48s 0 is the hundreds and 3 so answer is 03 00 03 10 that's 303A. well it's an mathematical lemma I found it in a perhaps maths book describing old Indian formulas discovered then so the solution is a complex. there are mainly three methods or more but I shared the straight forward one. however I see the problem is related to computer so may be some other method is supposed to be done. yes there are various tools available for it too like the windows default calculator too. if there is to make a program it can be used too just run a loop inside that keep on dividing. may be some inbuilt function for that too but I don't know
8th Nov 2016, 4:45 AM
Sandeep Chatterjee
0
example please
8th Nov 2016, 4:28 AM
MANPREET SINGH Virk
MANPREET SINGH Virk - avatar
0
int myInt = 2934; string myHex = myInt.ToString("X5"); //for caps x or X --> for caps and small 5 --> no of digits
8th Nov 2016, 4:51 AM
மனோஜ்குமார் பழனிச்சாமி
மனோஜ்குமார் பழனிச்சாமி - avatar