Posted on by Kalkicode
Code String

Print alphabets from A to Z

Printing alphabets from A to Z means displaying all the 26 letters of the English alphabet in sequence, starting from A(a) and ending with Z(z). Here's an example:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

a b c d e f g h i j k l m n o p q r s t u v w x y z

This sequence of letters is commonly referred to as the "alphabet" and is used in various contexts, such as language, education, and communication.

Here given code implementation process.

/*
  Java program for
  Print alphabets from A to Z
*/
public class Alphabets
{
	private void alphabetsAtoZ(char first, char last)
	{
		for (char alphaCharacter = first; 
             alphaCharacter <= last;
			++alphaCharacter)
		{
			// Disply character
			System.out.print("  " + alphaCharacter);
		}
	}
	// Handles the request of printing value of english alphabets
	public void printAlphabets()
	{
		// Case A
		System.out.print("Alphabets from (a to z) \n");
		this.alphabetsAtoZ('a', 'z');
		// Case B
		System.out.print("\nAlphabets from (A to Z) \n");
		this.alphabetsAtoZ('A', 'Z');
	}
	public static void main(String[] args)
	{
		Alphabets task = new Alphabets();
		// Test
		task.printAlphabets();
	}
}

Output

Alphabets from (a to z)
  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z
Alphabets from (A to Z)
  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z
// Include header file
#include <iostream>
using namespace std;
/*
  C++ program for
  Print alphabets from A to Z
*/
class Alphabets
{
	public: void alphabetsAtoZ(char first, char last)
	{
		for (char alphaCharacter = first; 
             alphaCharacter <= last; 
             ++alphaCharacter)
		{
			// Disply character
			cout << "  " << alphaCharacter;
		}
	}
	// Handles the request of printing value of english alphabets
	void printAlphabets()
	{
		// Case A
		cout << "Alphabets from (a to z) \n";
		this->alphabetsAtoZ('a', 'z');
		// Case B
		cout << "\nAlphabets from (A to Z) \n";
		this->alphabetsAtoZ('A', 'Z');
	}
};
int main()
{
	Alphabets *task = new Alphabets();
	// Test
	task->printAlphabets();
	return 0;
}

Output

Alphabets from (a to z)
  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z
Alphabets from (A to Z)
  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z
// Include namespace system
using System;
/*
  Csharp program for
  Print alphabets from A to Z
*/
public class Alphabets
{
	private void alphabetsAtoZ(char first, char last)
	{
		for (char alphaCharacter = first; 
             alphaCharacter <= last; 
             ++alphaCharacter)
		{
			// Disply character
			Console.Write("  " + alphaCharacter);
		}
	}
	// Handles the request of printing value of english alphabets
	public void printAlphabets()
	{
		// Case A
		Console.Write("Alphabets from (a to z) \n");
		this.alphabetsAtoZ('a', 'z');
		// Case B
		Console.Write("\nAlphabets from (A to Z) \n");
		this.alphabetsAtoZ('A', 'Z');
	}
	public static void Main(String[] args)
	{
		Alphabets task = new Alphabets();
		// Test
		task.printAlphabets();
	}
}

Output

Alphabets from (a to z)
  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z
Alphabets from (A to Z)
  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z
<?php
/*
  Php program for
  Print alphabets from A to Z
*/
class Alphabets
{
	private function alphabetsAtoZ($first, $last)
	{
		for ($alphaCharacter = ord($first); 
             $alphaCharacter <= ord($last); 
             ++$alphaCharacter)
		{
			// Disply character
			echo("  ".chr($alphaCharacter));
		}
	}
	// Handles the request of printing value of english alphabets
	public	function printAlphabets()
	{
		// Case A
		echo("Alphabets from (a to z) \n");
		$this->alphabetsAtoZ('a', 'z');
		// Case B
		echo("\nAlphabets from (A to Z) \n");
		$this->alphabetsAtoZ('A', 'Z');
	}
}

function main()
{
	$task = new Alphabets();
	// Test
	$task->printAlphabets();
}
main();

Output

Alphabets from (a to z)
  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z
Alphabets from (A to Z)
  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z
package main
import "fmt"
/*
  Go program for
  Print alphabets from A to Z
*/

func  alphabetsAtoZ(first, last byte) {
	for alphaCharacter := first ; alphaCharacter <= last ; alphaCharacter++ {
		// Disply character
		fmt.Printf("  %c", alphaCharacter)
	}
}
// Handles the request of printing value of english alphabets
func printAlphabets() {
	// Case A
	fmt.Print("Alphabets from (a to z) \n")
	alphabetsAtoZ('a', 'z')
	// Case B
	fmt.Print("\nAlphabets from (A to Z) \n")
	alphabetsAtoZ('A', 'Z')
}
func main() {
	// Test
	printAlphabets()
}

Output

Alphabets from (a to z)
  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z
Alphabets from (A to Z)
  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z
/*
  Node JS program for
  Print alphabets from A to Z
*/
class Alphabets
{
	alphabetsAtoZ(first, last)
	{
		for (var alphaCharacter = first.charCodeAt(0); 
             alphaCharacter <= last.charCodeAt(0); 
             ++alphaCharacter)
		{
			// Disply character
			process.stdout.write("  " + String.fromCharCode(alphaCharacter));
		}
	}
	// Handles the request of printing value of english alphabets
	printAlphabets()
	{
		// Case A
		process.stdout.write("Alphabets from (a to z) \n");
		this.alphabetsAtoZ('a', 'z');
		// Case B
		process.stdout.write("\nAlphabets from (A to Z) \n");
		this.alphabetsAtoZ('A', 'Z');
	}
}

function main()
{
	var task = new Alphabets();
	// Test
	task.printAlphabets();
}
main();

Output

Alphabets from (a to z)
  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z
Alphabets from (A to Z)
  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z
#  Python 3 program for
#  Print alphabets from A to Z
class Alphabets :
	def alphabetsAtoZ(self, first, last) :
		alphaCharacter = ord(first)
		while (alphaCharacter <= ord(last)) :
			#  Disply character
			print("  ", chr(alphaCharacter), end = "")
			alphaCharacter += 1
		
	
	#  Handles the request of printing value of english alphabets
	def printAlphabets(self) :
		#  Case A
		print("Alphabets from (a to z) ")
		self.alphabetsAtoZ('a', 'z')
		#  Case B
		print("\nAlphabets from (A to Z) ")
		self.alphabetsAtoZ('A', 'Z')
	

def main() :
	task = Alphabets()
	#  Test
	task.printAlphabets()

if __name__ == "__main__": main()

Output

Alphabets from (a to z)
   a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u   v   w   x   y   z
Alphabets from (A to Z)
   A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z
#  Ruby program for
#  Print alphabets from A to Z
class Alphabets 
	def alphabetsAtoZ(first, last) 
		alphaCharacter = first.ord
		while (alphaCharacter <= last.ord) 
			#  Disply character
			print("  ", alphaCharacter.chr)
			alphaCharacter += 1
		end

	end

	#  Handles the request of printing value of english alphabets
	def printAlphabets() 
		#  Case A
		print("Alphabets from (a to z) \n")
		self.alphabetsAtoZ('a', 'z')
		#  Case B
		print("\nAlphabets from (A to Z) \n")
		self.alphabetsAtoZ('A', 'Z')
	end

end

def main() 
	task = Alphabets.new()
	#  Test
	task.printAlphabets()
end

main()

Output

Alphabets from (a to z) 
  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z
Alphabets from (A to Z) 
  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z
/*
  Scala program for
  Print alphabets from A to Z
*/
class Alphabets()
{
	def alphabetsAtoZ(first: Char, last: Char): Unit = {
		var alphaCharacter: Int = first.toInt;
		while (alphaCharacter <= last.toInt)
		{
			// Disply character
			print("  " + alphaCharacter.toChar);
			alphaCharacter += 1;
		}
	}
	// Handles the request of printing value of english alphabets
	def printAlphabets(): Unit = {
		// Case A
		print("Alphabets from (a to z) \n");
		this.alphabetsAtoZ('a', 'z');
		// Case B
		print("\nAlphabets from (A to Z) \n");
		this.alphabetsAtoZ('A', 'Z');
	}
}
object Main
{
	def main(args: Array[String]): Unit = {
		var task: Alphabets = new Alphabets();
		// Test
		task.printAlphabets();
	}
}

Output

Alphabets from (a to z)
  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z
Alphabets from (A to Z)
  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z
/*
  Swift 4 program for
  Print alphabets from A to Z
*/
class Alphabets
{
	func alphabetsAtoZ(_ first: Character, _ last: Character)
	{
		var alphaCharacter: Int = Int(
          UnicodeScalar(String(first))!.value
        );
      	let end = Int(
          UnicodeScalar(String(last))!.value
        );
		while (alphaCharacter <= end)
		{
			// Disply character
			print("  ", 
                  Character(UnicodeScalar(alphaCharacter)!), 
                  terminator: "");
			alphaCharacter += 1;
		}
	}
	// Handles the request of printing value of english alphabets
	func printAlphabets()
	{
		// Case A
		print("Alphabets from (a to z) ");
		self.alphabetsAtoZ("a", "z");
		// Case B
		print("\nAlphabets from (A to Z) ");
		self.alphabetsAtoZ("A", "Z");
	}
}
func main()
{
	let task: Alphabets = Alphabets();
	// Test
	task.printAlphabets();
}
main();

Output

Alphabets from (a to z)
   a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u   v   w   x   y   z
Alphabets from (A to Z)
   A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z
/*
  Kotlin program for
  Print alphabets from A to Z
*/
class Alphabets
{
	fun alphabetsAtoZ(first: Char, last: Char): Unit
	{
		var alphaCharacter = first.toInt();
		while (alphaCharacter <= last.toInt())
		{
			// Disply character
			print("  " + alphaCharacter.toChar());
			alphaCharacter += 1;
		}
	}
	// Handles the request of printing value of english alphabets
	fun printAlphabets(): Unit
	{
		// Case A
		print("Alphabets from (a to z) \n");
		this.alphabetsAtoZ('a', 'z');
		// Case B
		print("\nAlphabets from (A to Z) \n");
		this.alphabetsAtoZ('A', 'Z');
	}
}
fun main(args: Array < String > ): Unit
{
	val task: Alphabets = Alphabets();
	// Test
	task.printAlphabets();
}

Output

Alphabets from (a to z)
  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z
Alphabets from (A to Z)
  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z

Comment

Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment