In this program, we are going to see how we can print alphabets in C. The program is pretty simple and straight forward. Here ASCII value of the characters comes into the picture, we use the ASCII value of starting and end character to run the loop.

See also: Find ASCII value of a character

Logic

ASCII value of small letter “a” is 97 and for “z” it is 122, so we run the loop from 97 to 122 and then inside the loop we have to print the current character.

%c inside the printf(“%c “) prints the character value of an alphabet.

Program

#include <stdio.h>

int main() {

    char c;

    printf("Alphabets from a - z are: \n");

    // Start from ASCII value of small letter a.
    for(c = 'a'; c <= 'z'; c++) {

        printf("%c ", c);

    }

    return 0;
}

Output

Alphabets from a - 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