Algorithm
1. Set up a loop to iterate through the alphabets.
a. Initialize a variable (e.g., 'char currentLetter') to represent the current alphabet.
b. Use a loop (for or while) to iterate from 'A' to 'Z'.
i. Inside the loop, print the current alphabet.
2. End the program.
Code Examples
#1 Code Example- Display uppercased alphabet using for loop
Code -
Java Programming
class Main {
public static void main(String[] args) {
char c;
for(c = 'A'; c < = 'Z'; ++c)
System.out.print(c + " ");
}
}
Copy The Code &
Try With Live Editor
Output
#2 Code Example- Display lowercase alphabet using for loop
Code -
Java Programming
class Main {
public static void main(String[] args) {
char c;
for(c = 'a'; c < = 'z'; ++c)
System.out.print(c + " ");
}
}
Copy The Code &
Try With Live Editor
Output
Demonstration
Java Programing Example to Display Alphabets (A to Z) using loop-DevsEnv