Last Updated on July 2, 2023 by Mayank Dham
The abbreviation ASCII stands for the "American Standard Code for Information Interchange," which is a standardized data-encoding format utilized for computer-to-computer communication. ASCII assigns numeric values to various characters, including letters, numerals, punctuation marks, and other computer symbols. Lowercase alphabet characters in ASCII have values ranging from 97 to 122, while uppercase alphabet characters have values ranging from 65 to 90. By checking if the ASCII value of a character inputted by the user falls within the range of 97 to 122 or 65 to 90, it can be determined if the character is an alphabet. This section will delve into the ASCII codes of lowercase and uppercase letters from "a" to "z" in detail.
What is ASCII Values?
ASCII (American Standard Code for Information Interchange) values are numerical representations assigned to characters within the ASCII character set. In ASCII, each character is assigned a distinct 7-bit code, corresponding to a number ranging from 0 to 127. For instance, the ASCII value of the letter "A" is 65, the ASCII value of the digit "0" is 48, and the ASCII value of the space character is 32. These ASCII values are frequently employed in computer programming to handle and manipulate text characters.
One of the most basic uses of ASCII is to describe the 26 letters of the English alphabet, both uppercase, and lowercase. The ASCII values for uppercase letters range from 65 to 90, while the ASCII values for lowercase letters range from 97 to 122. So this range is ASCII values of the alphabet.
You can also refer to this for the ASCII table:
ASCII Code of a to z
The ASCII code of lowercase "a" is 97 and the ASCII code of lowercase "z" is 122.
The ASCII code of all lowercase letters from a to z
Code Implementation
#include <iostream> using namespace std; int main() { char c; // Prints the ASCII value of all Uppercase Alphabet for(c = 'a'; c <= 'z'; c++){ cout << c << " = " << (int)c <<endl; } return 0; }
Output
a = 97
b = 98
c = 99
d = 100
e = 101
f = 102
g = 103
h = 104
i = 105
j = 106
k = 107
l = 108
m = 109
n = 110
o = 111
p = 112
q = 113
r = 114
s = 115
t = 116
u = 117
v = 118
w = 119
x = 120
y = 121
z = 122
Explanation
In the above c++ program we make char variable c and then we apply for loop from a to z and simply print the ASCII value of alphabet corresponding to it. If we observe on the output screen we got our first value is 97 and our last value is 122, which shows the range of lowercase alphabet (a to z) is 97 to 122.
ASCII Code of A to Z
The ASCII code of uppercase "A" is 97 and the ASCII code of lowercase "Z" is 90.
Code Implementation
#include <iostream> using namespace std; int main() { char c; // Prints the ASCII value of all Uppercase Alphabet for(c = 'A'; c <= 'Z'; c++){ cout << c << " = " << (int)c <<endl; } return 0; }
Output
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 = 90
Explanation
In the above C++ program also we use for loop to print ASCII value of from A to Z(upper case ) and range we got is 65 to 90.
Conclusion
In conclusion, ASCII (American Standard Code for Information Interchange) values are numerical representations assigned to characters in the ASCII character set. Each character is associated with a unique 7-bit code, ranging from 0 to 127. The ASCII values of the alphabet vary from 65 to 90 for uppercase letters and from 97 to 122 for lowercase letters. These ASCII values are commonly utilized in computer programming to represent and manipulate text characters.
Frequently Asked Questions(FAQs)
Here are the FAQs on ASCII values of the alphabet
Q1. What is the ASCII value of the letter ‘A’?
Ans. The ASCII value of the letter ‘A’ is 65.
Q2. What is the ASCII value of the letter ‘a’?
Ans. The ASCII value of the letter ‘a’ is 97.
Q3. How are ASCII values used in programming?
Ans. ASCII values are often used in programming to compare characters or to perform operations based on the character’s position in the ASCII code. For example, in some programming languages, you can convert a character to its ASCII value and then perform arithmetic operations on it.
Q4. How do I convert a character to its ASCII value?
Ans. In many programming languages, you can use built-in functions or methods to convert a character to its ASCII value. For example, in Python, you can use the ord() function to get the ASCII value of a character. For instance, ord(‘A’) would return 65.
Q5. What is the range of ASCII values for alphabets?
Ans. The range of ASCII values for uppercase letters A-Z is 65-90, and the range for lowercase letters a-z is 97-122.
Q6. Can ASCII values be negative?
Ans. No, ASCII values are always positive integers. The lowest possible ASCII value is 0, which represents the null character, and the highest possible value is 127, which represents the delete character.
Q7. Are all alphabets represented in the ASCII code?
Ans. No, the ASCII code only represents the Latin alphabet used in English and a few other Western languages. Other alphabets, such as Cyrillic, Greek, and Hebrew, have their own character sets with different numeric values assigned to each character.
Q8. Can ASCII values be used for international languages?
Ans. While ASCII values were designed for the English language, they can be used for other languages that use the same character set, such as French, German, and Spanish. However, ASCII values cannot be used for languages with non-Latin alphabets, such as Chinese, Japanese, and Arabic, which require different character sets.