Question

Print the Alphabet (A to Z) using for loop in C Language

Updated on May 31, 2025 | By Learnzy Admin | 👁️ Views: 175 students

Solution
✔ Verified

This C program uses a for loop to print all uppercase letters of the English alphabet, from A to Z. In C, characters are represented using ASCII values. The character 'A' has the ASCII value 65, and 'Z' has the value 90.

The loop starts with the character variable ch initialized to 'A', and it runs until ch is less than or equal to 'Z'. In each iteration, the value of ch is printed, and then incremented to the next character in the alphabet using ch++.

This approach works because in C, characters can be compared and incremented just like integers due to their underlying ASCII representation.

#include <stdio.h>

int main() {
    for (char ch = 'A'; ch <= 'Z'; ch++) {
        printf("%c ", ch);
    }
    return 0;
}

Output:--

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 

 

 

Was this solution helpful? 16
Click here to download practice questions on For Loop In C

More Questions on For Loop In C

Question 1

Print a Pattern (Right-Angled Triangle) using for loop in C Language


View solution
Question 2

Calculate factorial of a Number (e.g., 5!) using for loop in C language


View solution
Question 3

Calculate sum of First 10 Natural Numbers using for loop in C Language.


View solution
Question 4

Print Table of 5 using for loop in C Language.


View solution
Question 5

Print Even Numbers from 2 to 20 using for loop in C Language.


View solution
Question 6

Print Numbers from 1 to 10 using for loop in C Language.


View solution