![]() |
VOOZH | about |
Given a character, we need to print its ASCII value in C++.
👁 C++ Program To Print ASCII Value of a Character
Examples:
Input: a
Output: 97Input: D
Output: 68
Here int() is used to convert a character to its ASCII value. Below is the C++ program to implement the above approach:
The ASCII value of A is 65
Time complexity: O(1) since performing constant operations
Auxiliary Space: O(1)
Below is the C++ program to print the ASCII value of each character in a string:
Character ASCII Value G 71 e 101 e 101 k 107 s 115 f 102 o 111 r 114 G 71 e 101 e 101 k 107 s 115
Below is the C++ program to print the ASCII value of all the characters:
Character ASCII Value A 65 B 66 C 67 D 68 E 69 F 70 G 71 H 72 I 73 J 74 K 75 L 76 M 77 N 78 O 79 P 80 Q 81 R 82 S 83 T 84 U 85 V 86 W 87 X 88 Y 89 Z ...
Please refer complete article on Program to print ASCII Value of a character for more details!