top of page

Write a C program to display Alphabets (a - z) and (A - Z) using loop

Updated: Jul 3

Loops can be used to perform repetitive tasks efficiently and one such task is displaying the entire range of alphabets. In this article, we will explore how to write a C program that utilizes loops to display both lowercase (a - z) and uppercase (A - Z) alphabets.


C program to print Lower Case alphabets:

Consider the below code example where we will print the lowercase alphabets (a-z) using a loop:

#include <stdio.h>
int main()
{
    char c;
 
    for(c = 'a'; c <= 'z'; ++c)
      printf("%c ", c);
    
    return 0;
}

Output:

Loops can be used to perform repetitive tasks efficiently and one such task is displaying the entire range of alphabets. In this article, we will explore how to write a C program that utilizes loops to display both lowercase (a - z) and uppercase (A - Z) alphabets.


C program to print Upper Case alphabets:

Consider the below example code where we will print the Upper case alphabets (A-Z) using a loop:

#include <stdio.h>
int main()
{
    char c;
 
    for(c = 'a'; c <= 'z'; ++c)
      printf("%c ", c);
    
    return 0;
}

Output:

Loops can be used to perform repetitive tasks efficiently and one such task is displaying the entire range of alphabets. In this article, we will explore how to write a C program that utilizes loops to display both lowercase (a - z) and uppercase (A - Z) alphabets.

Conclusion

You have learned how loops can be used to automate the generation and printing of alphabets in C.

0 comments
bottom of page