In this problem we will learn how to print Alphabets using ASCII values in Java. Before this we post the similar program in C++. The Alphabets has a special number and these numbers start from 65 . 65 is the starting ASCII number to write alphabets in upper case. Here is the source code of this program which help you in better understanding.
Source Code
public class ASCII_Values {
public static void main(String[] args) {
System.out.println("\t \t \t LEP Tutorials \n \n \n");
System.out.println(" Print Alphabets with ASCII Values \n");
int alphabets;
for (int i = 65; i<91; i++)
{
System.out.print((char)i +" ");
}
}
}
Output of the Program
Print Alphabets with ASCII Values in Java |
A character and it's ASCII value can be used interchangeably. The ASCII value of alphabets are consecutive natural numbers. Java program to print ASCII value of alphabets Sample Java programs
ReplyDeleteProgramming tutorial