ASCII stands for American Standard Code for Information Interchange. Computers can only understand numbers, so an ASCII code is the numerical representation of a character such as ‘a’ or ‘@’ or an action of some sort.
ASCII lookup table is a tabular representation of corresponding values associated to a character i.e. we can lookup the corresponding octal, decimal, hexadecimal or HTML ASCII of a character.
Here, we are implementing an ASCII lookup table which takes a character as an input and returns the equivalent octal, decimal, hexadecimal and HTML ASCII value for the character. This ASCII lookup table works for alphabets, digits, operators, separators and special symbols.
Input character = @ Output : Octal value: 100 Decimal value: 64 Hexadecimal value: 40 HTML value: &#064;
Step 1: Convert given character into it’s equivalent ASCII in decimal form. This can be done by implicitly typecasting the character into an integral value(or subtracting by null).
Step 2: The value computed in step 1 becomes the decimal representation of the character. Convert the decimal value in octal and hexadecimal forms to obtain the ASCII of the input character into the given formats.
Step 3: Add characters &# as prefix and ; as postfix of the decimal ASCII, the expression obtained becomes the HTML ASCII of the given character.
This way we can easily implement the ASCII lookup table. Follow the code below to see the implementation.
Octal value: 100 Decimal value: 64 Hexadecimal value: 40 HTML value: &#064;
- Program to print ASCII Value of a character
- Program to find the XOR of ASCII values of characters in a string
- Program to find the product of ASCII values of characters in a string
- Program to find the largest and smallest ASCII valued characters in a string
- Program to implement FLAMES game
- Program to print multiplication table of a number
- Multiplication table till N rows where every Kth row is table of K upto Kth term
- ascii() in Python
- Sub-strings having exactly k characters that have ASCII value greater than p
- Count of alphabets having ASCII value less than and greater than k
- Print given sentence into its equivalent ASCII form
- Count and Print the alphabets having ASCII value in the range [l, r]
- Convert a string to hexadecimal ASCII values
- Convert the ASCII value sentence to its equivalent string
- Map function and Dictionary in Python to sum ASCII values
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : nitin mittal