Monday, June 6, 2011

Converting Decimal to Hexadecimal Visual Basic

Converting Decimal to Hexadecimal Visual Basic

Decimal number that is composed of 10 digits: 0,1,2,3,4,5,6,7,8,9, while composed of 16 hexadecimal digits are: 0,1,2,3,4,5,6 , 7,8,9, A, B, C, D, E, F. We note that the first 10-digit hexadecimal number is a decimal number. It could be argued that the decimal number is a subset of hexadecimal numbers.
From the programming side of the decimal numbers apply in general, while hexadecimal numbers are generally used to shorten the writing of a decimal or binary numbers. Implementation hexadecimal pengelamatan much visible in the computer memory.

Hexadecimal Decimal
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 A
11 B
12 C
13 D
14 E
15 F

To perform the conversion of decimal numbers to hexadecimal is to share with the decimal number 16 as a hexadecimal base. For example, suppose there is a decimal number 9 then the number heksadesimalnya are:
9: 16 = 0 remainder 9
then the hexadecimal number is 9

Suppose there is a decimal number 25 then the number heksadesimalnya are:
25: 16 = 1 remainder 9
1: 16 = 0 remainder 1
so the number is 19 heksadeimalnya

Algorithm:
0. Start
1. Determine the decimal number, eg N
2. As long as N> 16 do
Results = N Div 16
Time = N Mod 16
N = Result
Hex = Hex + Time
3. Repeat to 2
4. Print Hex
5. Completed

Implementation
Private Sub Form_Activate ()
Dim N, Results, Time As Byte
Hex As String Dim
Hex = ""
While N> 16
Results = N Div 16
Time = N Mod 16
N = Result
Hex = Hex + Time
Wend
Print Hex
End Sub

No comments:

Post a Comment

 
THANK YOU FOR VISITING