C Program to Print Alphabets between A and Z

How to write a C Program to Print Alphabets between A and Z using For Loop and While Loop?.

C Program to Print Alphabets between A and Z using For Loop

This C program will display alphabets between A and Z using For Loop. In this example, For Loop will make sure that the character (ch) is between A and Z.

/* C Program to Print Alphabets from a to z */

#include <stdio.h>
 
int main()
{
  	char ch;

	printf("\n List of Alphabets from a to z are : \n");  
  	for(ch = 'A'; ch <= 'Z'; ch++)
  	{
  		printf(" %c\t", ch);	
	}
  
  	return 0;
}

C Alphabets between A and Z using For Loop output

 List of Alphabets from a to z are : 
 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	

Program to Print Alphabets between A and Z using ASCII Codes

Instead of hard-coding A and Z, in this program, we are using the ASCII codes to print alphabets. I suggest you refer to the ASCII Table to understand the ASCII values of each character in C Programming.

From the below code snippet you can see, A = 65 and Z = 90

/* C Program to Print Alphabets between A and Z */

#include <stdio.h>
 
int main()
{
  	int i;

	printf("\n List of Alphabets Between A and Z are : \n");  
  	for(i = 65; i <= 90; i++)
  	{
  		printf(" %c\t", i);	
	}
  
  	return 0;
}
 List of Alphabets Between A and Z are : 
 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	

Program to Print Alphabets between A and Z using While Loop

This Program to Print Alphabets between A and Z example is the same as above. We just replaced the For Loop with While Loop.

/* C Program to Print Alphabets between A and Z */

#include <stdio.h>
 
int main()
{
  	char ch = 'A';

	printf("\n List of Alphabets between A and Z are : \n");  
  	while(ch <= 'Z')
  	{
  		printf(" %c\t", ch);
		ch++;	
	}
  
  	return 0;
}
 List of Alphabets between A and Z are : 
 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	

Program to Print Alphabets within a Given Range

This C program allows the user to enter the starting alphabet (A to Z). Next, the program will print the list of all alphabets between Starting_Char and Z.

/* C Program to Print Alphabets between A and Z */

#include <stdio.h>
 
int main()
{
  	char ch, Starting_Char;
  
  	printf("\n Please Enter the Starting Alphabet : ");
  	scanf("%c", &Starting_Char);

	printf("\n List of Alphabets from %c to Z are : \n", Starting_Char);  
  	for(ch = Starting_Char; ch <= 'Z'; ch++)
  	{
  		printf(" %c\t", ch);	
	}
  
  	return 0;
}
C Program to Print Alphabets between A and Z 4