Input and Output Using Characters

The input term and output term are straightforward. Sometimes it is complex to use the full stops and quotes, and it is not always suitable. For example, to define a predicate that would read characters in series from the keyboard and count the number of vowels is really tedious. For this kind of problem, a better approach is to input a character at a time. To apply this approach, we have to know the ASCII value of the characters. ASCII (American Standard Code for Information Interchange) value is an integer from 0 to 255.

All non-printing characters and printing characters have their corresponding ASCII value. ASCII value of characters, which is less than or equal to 32 is called as control characters or white space characters.

The following table shows the ASCII values of printable characters and some others.

NumberCharacterDescription
9Tab
10end of record
32space
33!exclamation mark
34quotation mark
35#number sign
36$dollar sign
37%percent sign
38&ampersand
39apostrophe
40(left parenthesis
41)right parenthesis
42*asterisk
43+plus sign
44,comma
45-hyphen
46.period
47/slash
4800 digit
4911 digit
5022 digit
5133 digit
5244 digit
5355 digit
5466 digit
5577 digit
5688 digit
5799 digit
58:colon
59;semicolon
60<less-than
61=equals-to
62>greater-than
63?question mark
64@at sign
65Auppercase A
66Buppercase B
67Cuppercase C
68Duppercase D
69Euppercase E
70Fuppercase F
71Guppercase G
72Huppercase H
73Iuppercase I
74Juppercase J
75Kuppercase K
76Luppercase L
77Muppercase M
78Nuppercase N
79Ouppercase O
80Puppercase P
91Quppercase Q
82Ruppercase R
83Suppercase S
84Tuppercase T
85Uuppercase U
86Vuppercase V
87Wuppercase W
88Xuppercase X
89Yuppercase Y
90Zuppercase Z
91[left square bracket
92\backslash
93]right square bracket
94^Caret
95_underscore
96`grave accent
97Alowercase a
98Blowercase b
99Clowercase c
100Dlowercase d
101Elowercase e
102Flowercase f
103Glowercase g
104Hlowercase h
105Ilowercase i
106Jlowercase j
107Klowercase k
108Llowercase l
109Mlowercase m
110Nlowercase n
111Olowercase o
112Plowercase p
113Qlowercase q
114Rlowercase r
115Slowercase s
116Tlowercase t
117Ulowercase u
118Vlowercase v
119Wlowercase w
120Xlowercase x
121Ylowercase y
122Zlowercase z
123{left curly brace
124|vertical bar
125}right curly brace
126~tilde





Latest Courses