Question: Part 1 - The Character Data type Ask the user to enter a letter from the English alphabet (a-2, A-Z), store that character and output
Part 1 - The Character Data type Ask the user to enter a letter from the English alphabet (a-2, A-Z), store that character and output what the user entered. Cast the character to an integer and output the internal integer representation of that character (Don't store the output of the cast in a variable, output directly). As a sanity check, refer to the ASCII Lookup table presented in our lecture. Question: is the below operation legal? int x = 'A': It is since character are internally represented as integers between 0 and 255. Use this to your advantage in the next step without having to cast the character to an integer. Now, using the modulus operator and an if-else statement, output to the user whether the internal integer representation of the character entered is either even or odd
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
