Program to find the ASCII value of a character | faceprep

Program to find the ASCII value of a character | faceprep

Program to find the ASCII value of a character is discussed here. Given a character as input, the ASCII value of the character is displayed as output.

A character variable holds the ASCII value (an integer number between 0 and 127) rather than that character itself. That value is known as the ASCII value.



program to find the ascii value of a character


For example, consider the given character as input.

Input: S

Output: 83

Input: s

Output: 115

Algorithm to find the ASCII value of a character

  • Input the given character.
  • Find the ASCII value of the character.
  • Print the ASCII value of the character.

The program to find the ASCII value of a character is given below.

@@coding::1@@


program to find the ascii value of a characterClick here to learn more about FACE Prep PRO


In this program, the user is asked to input a character which is stored on variable ch.

The ASCII value of that character is stored in variable ch,rather than that variable itself.

When %d format string is used, 115 (ASCII value of ‘s’) is displayed.

When %c format string is used, ‘s’ itself is displayed.


program to find the ascii value of charactersClick here to learn more about FACE Prep PRO



Recommended Programs


Program to find the ASCII value of a character

c