Passer de decimale a hexadecimal sans calculatrice ni tableau

chaserchubby Messages postés 2 Date d'inscription dimanche 10 octobre 2010 Statut Membre Dernière intervention 10 octobre 2010 - 10 oct. 2010 à 09:22
cs_ShayW Messages postés 3253 Date d'inscription jeudi 26 novembre 2009 Statut Membre Dernière intervention 3 décembre 2019 - 10 oct. 2010 à 12:27
bonjour
je suis novice en langage informatique j'essaie de convertir de décimale a hexa .j'arrive a convertir de décimale a binaire sans problème ça j'ai compris.
je sais que 120 en décimale cela fais 01111000
et que cela fais 78 en hexa avec un tableau de conversion mais j'aimerais savoir le calculer manuellement sans calculatrice ni tableau
merci d'avance

3 réponses

nhervagault Messages postés 6063 Date d'inscription dimanche 13 avril 2003 Statut Membre Dernière intervention 15 juillet 2011 37
10 oct. 2010 à 10:19
Salut

Console.WriteLine(value.ToString("X"))


en bonus pour completer

  
'To Binary from Integer 
dim binary  as String = Convert.ToString(startVal, base)
'To Integer From Binary      
dim  i as integer = Convert.ToInt32(binary, base)
0
chaserchubby Messages postés 2 Date d'inscription dimanche 10 octobre 2010 Statut Membre Dernière intervention 10 octobre 2010
10 oct. 2010 à 10:43
How to convert in manual decimal calculation 120 in hexadecimal without picture(board) nor calculator thank you in advance
0
cs_ShayW Messages postés 3253 Date d'inscription jeudi 26 novembre 2009 Statut Membre Dernière intervention 3 décembre 2019 57
10 oct. 2010 à 12:27
Hey
To convert a decimal number (the whole part)
divide by 16 repeat until the quotient = 0
for example
120 : 16 = 7 remain 8
7 : 16 = 0 remain 7
so 120 = 78 (hexa)

1000 : 16 = 62 remain 8
62 : 16 = 3 remain 14
3 : 16 = 0 remain 3
1000 = 3E8

if you have a binary number is easy to convert
into an hexa
divide the number in to group of 4 digits from
the lsb(last significant bit)
each group of 4 digits represents a hexa figure
for ex
01111000 0111 1000 = 78

1111101000 0011 1110 1000 = 3E8
0
Rejoignez-nous