C Programming – How to print A to Z or a to z alphabets

In this post we are going to write a simple C program to print alphabets, both Capital letter alphabets and Small letter alphabets.

It’s not so complicated as you would have imagined. Let’s see the code:

#include<stdio.h>
int main(){
	
	char i;
	
	printf("Small Letters:\n");
	//print small letters alphabets
	for(i = 'a'; i <='z'; i++){
	    printf("%c", i);
	}
	
	printf("\n\nCapital Letters:\n");   
	//print captial letters alphabets
	for(i = 'A'; i <='Z'; i++){
	    printf("%c", i);
	}
	return(0);
}

It’s so simple right??

Here is the output:

Small Letters:
abcdefghijklmnopqrstuvwxyz

Capital Letters:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
--------------------------------
Process exited after 0.04023 seconds with return value 0
Press any key to continue . . .

Learn everyday and enjoy!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top