How to print a to z in c using for loop

Created with Sketch.


You can print the lowercase English alphabet from a to z in C using a for loop and the ASCII values of the characters. Here’s an example code snippet:

#include <stdio.h>

int main() {
    char c;
    for (c = 'a'; c <= 'z'; ++c) {
        printf("%c ", c);
    return 0;


  • We declare a character variable c.
  • In the for loop, we initialize c to the ASCII value of the character ‘a’ (which is 97) and set the loop condition to continue until c is less than or equal to the ASCII value of the character ‘z’ (which is 122).
  • We use the printf function to print the character c followed by a space.
  • Finally, we return 0 to indicate the successful execution of the program.

Leave a Reply

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