I am working on a practice exam problem
The Problem On execution of this program, the user inputs two numbers. What is the value of xGuess so we can st
As you noticed, operations are performed on ASCII values of entered characters. In assembly, if you read characters from keyboard, you really get their ASCII values in registers, so let's say you enter 2 and 3 and want to add them, then you are really adding 50+51
. You have to subtract 48 first, from each entered character, because 48 is a value of 0 character in ASCII. I think this is called "stripping off the ASCII template". Then, if you want to display the result of calculation on the screen, you have to add 48 back to the result (only if entered character and the result is single digit, for bigger numbers it involves more operations). Howerer, this makes sense for characters 0-9. I don't know why would you want to make calculations on alphabet characters, like a and b in your example.