|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (5 bit)
|
binary value of G
hello PCmech members and non-members,
I had this question in a quiz competition but it went over my head. I don't have a clue/ procedure on how to find the binary value of the letter G and g. Please help me to come out of this problem. And also, please give me the procedure to solve this problem, as it'll be helpful later. Your help is highly appreciated. Thanks... |
|
|
|
|
|
#2 |
|
Member (10 bit)
Join Date: May 2000
Location: New Zealand
Posts: 546
|
Depends what they mean.
Could be that G / g = 7 (decimal) being the 7th letter of the English alphabet, and is therefore 111 in binary. Could also be the ASCII code for 'g' and 'G' (103 and 71 decimal if I have it looked up right), converted to binary (I'll leave that conversion to you). To be fair, the question is very ambiguous! David. |
|
|
|
|
|
#3 |
|
Member (5 bit)
|
hi Mr. D_J,
I'm sorry for I missed some parts of the question. Yes, the question is ambiguous. The question is : What is the Binary conversion of the Character "G"? Please tell me how it's done. Or are there any site that teaches binary and how to do these types of problems? It'll be useful later. Thanks in advance! "A little knowledge is a dangerous thing" |
|
|
|
|
|
#4 |
|
Member (12 bit)
Join Date: Mar 1999
Location: MN or WI
Posts: 3,017
|
Well, you need to know the ASCII codes of those characters. Would you be given them in hexadecimal? I'll assume not, but I'll assume you know the basics of hexadecimal (e.g. numbers run 0-F, you have a ones digit, a sixteens digit, a two-fifty-sixes digit, etc.)
In any event, 'G' is 47h, 'g' is 67h. You can remember this because for capitals, you add 40h, for lowercase, add 60h. Since g is the 7th letter, which is 07h, add these (in hex!) to get the hexadecimal values. I'll work through an example, the letter z: 1) Z is the 26th letter. 2) Convert 26 to hex. * 26 is greater than 16 and less than 32, so the 'sixteens' digit is '1'. So we know that it is 1_h. * 26 - 16 = 10, so the 'ones' digit is 'A'. So, z is the '1A'th letter of the alphabet. 3) Add either 40h or 60h. 40h for capitals, 60h for lowercase. So, the character 'Z' = 1Ah + 40h = 5Ah. Similarly, 'z' = 1Ah + 60h = 7Ah. 4) Now, to convert from hex to binary is very easy. Each hex digit is replaced with 4 bits. You convert each digit separately (this works because 16 is a power of 2). So, 'Z' = 5Ah. 5 = 0101, A = 1010. So 'Z' = 0101 1010 Similarly, 'z' = 7Ah = 0111 1010. Hope that helps. BTW, to convert from hex to binary, you need to know the following: 0 = 0000 1 = 0001 2 = 0010 3 = 0011 4 = 0100 5 = 0101 6 = 0110 7 = 0111 8 = 1000 9 = 1001 A = 1010 B = 1011 C = 1100 D = 1101 E = 1110 F = 1111 You can always remember this because each bit, from right to left, represents a power of 2. So, from left to right, the bits represent 8, 4, 2, 1. 'C' = 12 decimal = 8 + 4, so the 8 and 4 bits are set. Last edited by Paul Victorey; 01-08-2003 at 10:19 PM. |
|
|
|
|
|
#5 |
|
Member (10 bit)
Premium Member
Join Date: Mar 2001
Location: N'Awlins, LA
Posts: 517
|
6
|
|
|
|
|
|
#6 |
|
Member (5 bit)
|
hi paul,
thanks for your help. It is highly appreciated. One more thing ;-). Are there any good sites that i can learn binary number systems? If you know any sites then please do not hesitate to post the URL. Thanks...Cheers!!! |
|
|
|
|
|
#7 |
|
Member (12 bit)
Join Date: Mar 1999
Location: MN or WI
Posts: 3,017
|
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|