Find ASCII value for the Key / Character pressed

To find the ASCII value of the character you're pressing while the program is running.


Method 1: 


If we try to print the character in the character variable using "%d" format specifier, it will actually print the ASCII value of the character that is stored in the character variable.                                                

Implementation:





Method 2: 


It is similar to "Method 1" but different approach to get the character in runtime and printing it. You can also loop it until user enter 'Dont want to continue' or any number you want. It will keep on printing ascii for the character user entering, if the user enters the number, it quits.

Implementation:



Output:

Value          ASCII
a                      97