Print ASCII Value II

You are given a single character ch.

Your task is to find its ASCII value and print it.

Example 1:

Input:

ch = 'A'

Output:

65

Explanation:

The character 'A' is an uppercase English letter. Its ASCII value is 65, so the output is 65.

Example 2:

Input:

ch = '0'

Output:

48

Explanation:

The character '0' represents the digit zero, but its ASCII value is different from the integer 0. The ASCII value of the character '0' is 48.

Now Your Turn!

Pick the correct output for the given input

Input:

ch = 'B'

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • ch is a printable ASCII character

Hints

Frequently Occurring Doubts

Interview Follow-up Questions

0
class Solution {
public:
void asciiValue(char ch) {
// Write your code here
}
};
Test Case

Input:

Ch