What you see is not what you get.
The problem with printing out '1' and 1 is that they print out the same. But your code was using the char in an formula that showed you that '1' was not 1. This...
Type: Posts; User: Norm
What you see is not what you get.
The problem with printing out '1' and 1 is that they print out the same. But your code was using the char in an formula that showed you that '1' was not 1. This...
You need to convert/parse the char value if you want to convert a '1' to a 1.
A quick and dirty way to do that is to subtract '0' from it.
'1' - '0' = 1
Did you enter a 1 or a 2 also????
You need to simplify the input for testing. Change the input to one digit: 1
Add printlns with labels that say what is being printed to the code to show the...
You did not show what the input you entered for the program.
Why do you read the input as int vs as String?
Can you show the program's input and output?
Add some comments to the output showing what you want it to be.