Printing Ascii Codes as Characters Alphabets & Digits – CSKC
Sign In

Search

Code Learning #JAVA#3512    siteicon   siteicon  

Printing Ascii Codes as Characters Alphabets & Digits

Printing uppercase alphabets, lowercase alphabets, digits by printing them as characters typecasted from its integer form ascii values.

Learning Objectives

  • Understanding ASCII code values of different Alphabets and Numbers
  • Typecasting from numbers to characters.

Source Code

TC++ #3512

Source Code

×

Ask AI About This Code

Default Prompt that is passed along with the code is given below, You can write your own prompt if you so desire.



×

Test Java

Code Understanding

System.out.println(“– Uppercase characters with their ASCII codes –“);
for(int i=65;i<=90;++i) System.out.print(((char)i)+”=”+i+” “);
Prints character symbols of ASCII codes from 65 to 90 which are A – Z

System.out.println(“n– Lowercase characters with their ASCII codes –“);
for(int i=97;i<=122;++i) System.out.print(((char)i)+”=”+i+” “);
Prints character symbols of ASCII codes from 97 to 122 which are a – z

System.out.println(“n– Digits 0 to 9 with their ASCII codes –“);
for(int i=48;i<=57;++i) System.out.print(((char)i)+”=”+i+” “);
Prints character symbols of ASCII codes from 48 to 57 which are 0 – 9

 

Notes

  • ASCII codes from 32 to 126 are displayable characters.
  • The lowercase ascii equivalent can always be obtained by adding 32 to uppercase alphabets and vice-versa is also true.


Suggested Filename(s): CharAndAscii.java



Share

Created: 16-Feb-2018 17:53 | Updated: 21-Mar-2018 19:10|