Character to Code
Easyjava
Read a single character and print its integer (Unicode) value by casting it to int.
Input: one line with a single character.
Output: one line — the integer code of that character.
Example 1
Input
A
Output
65
Example 2
Input
a
Output
97
- The character is a single printable ASCII character.
Hint 1
int code = (int) c; widens the char to its numeric value.
Hint 2
For letters, 'A' is 65 and 'a' is 97.
Every char has an underlying integer code. Casting to int (or just assigning to an int) reveals it: 'A' is 65, 'a' is 97, the digit character '0' is 48.