C Program To Print Lowercase Alphabet(a-z) using While loop


In this video tutorial we show you how to write C program to print all the lower case alphabets(a-z) using simple while loop.

Related Read:
while loop in C programming
C Program To Print Uppercase Alphabet(A-Z) using While loop

Note: In C programming language, every character variable holds an ASCII value rather than the character itself. You can check ASCII value of all the characters here: C Program To Print All ASCII Characters and Code

Note:
ASCII value range of lower case alphabets:
ASCII value of a is 97.
ASCII value of b is 98.
ASCII value of c is 99.
and so on till z ..
ASCII value of z is 122.

Source Code: C Program To Print Lowercase Alphabet(a-z) using While loop

#include < stdio.h >

int main()
{
    char ch = 'a';

    printf("Lowercase English Alphabets:\n");
    while(ch <= 'z')
    {
        printf("%c ", ch);
        ch++;
    }
    printf("\n");

    return 0;
}

Output:
Lowercase English Alphabets:
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

Logic To Print Lowercase Alphabet(a-z) using While loop

Each alphabet has it’s own(unique) ASCII value. We initialize the character variable ch to a. Alphabet a has a ASCII value of 97. 97 gets stored in ch. We iterate through the while loop until value of ch is less than or equal to z(i.e., upto ASCII value of z, which is 122). We print character value(%c) of the variable ch, which has the character and not the ASCII value. We keep incrementing the value of ch by 1 for each iteration of while loop.

Video Tutorial: C Program To Print Lowercase Alphabet(a-z) using While loop


[youtube https://www.youtube.com/watch?v=Gzj1M80Uug0]

YouTube Link: https://www.youtube.com/watch?v=Gzj1M80Uug0 [Watch the Video In Full Screen.]

For list of all c programming interviews / viva question and answers visit: C Programming Interview / Viva Q&A List

For full C programming language free video tutorial list visit:C Programming: Beginner To Advance To Expert

Leave a Reply

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