In this article, we will discuss the concept of C Program for print all Alphabet between given range using loops
In this post, we are going to learn how to display all the upper case(A to Z) and lower case (a to z) Alphabets between given range using loops on C programming language
The program displays all the upper case and lower case alphabet letters between given range using for loop in C language
Program 1
#include <stdio.h> #include <stdlib.h> int main() { char i,ch1,ch2; printf("Enter two Alphabet of the range: "); scanf("%c %c",&ch1,&ch2); //store the entered alphabets in variables ch1,ch2 for(i=ch1; i<=ch2; i++){ printf("%c ",i); //display uppercase or lower case Alphabets with space } getch(); return 0; }
When the above program is executed, it produces the following result
Case 1
Enter two Alphabet of the range: i n i j k l m n
Case 2
Enter two Alphabet of the range: A H A B C D E F G H
In the above program, we are using a for loop, this is used to print upper case Alphabet letters or lower case Alphabet letters
Approach
The program displays all the upper case and lower case alphabet letters between given range using while loop in C language
Program 2
#include <stdio.h> #include <stdlib.h> int main() { char i,ch1,ch2; printf("Enter the two Alphabet of the range: "); scanf("%c %c",&ch1,&ch2); //store the entered alphabets in variables ch1,ch2 i=ch1; while( i<=ch2){ printf("%c ",i); //display uppercase or lowercase Alphabets with space i++; } getch(); return 0; }
When the above program is executed, it produces the following result
Case 1
Enter two Alphabet of the range: m z m n o p q r s t u v w x y z
Case 2
Enter two Alphabet of the range:G T G H I J K L M N O P Q R S T
In the above program, we are using a while loop, this is used to print upper case Alphabet letters or lower case Alphabet letters
Approach
The program displays all the upper case and lower case alphabet letters between the given range using do-while loop in C language
Program 3
#include <stdio.h> #include <stdlib.h> int main() { char i,ch1,ch2; printf("Enter the two Alphabet of the range: "); scanf("%c %c",&ch1,&ch2); //store the entered alphabets in variables ch1,ch2 i=ch1; do{ printf("%c ",i); //display uppercase or lowercase Alphabets with space i++; } while( i<=ch2); getch(); return 0; }
When the above program is executed, it produces the following result
Case 1
Enter two Alphabet of the range: o y o p q r s t u v w x y
Case 2
Enter two Alphabet of the range: K S K L M N O P Q R S
In the above program, we are using a do-while loop, this is used to print upper case Alphabet letters or lower case Alphabet letters
Approach
Suggested for you
Similar post
Java program to print all upper case and lower case Alphabets
C++ program to print all upper case and lower case Alphabets
C program to print all upper case and lower case Alphabets
Java code to print all upper case and lower case Alphabets between the given range
C++ code to print all upper case and lower case Alphabets between the given range
C code to print all upper case and lower case Alphabets between the given range
PHP Star Triangle pattern program In this tutorial, we will discuss about PHP Star Triangle…
PHP Full Pyramid pattern program In this tutorial, we will discuss about PHP Full Pyramid…
5 methods to add two numbers in Java In this tutorial, we will discuss the…
Python full Pyramid star pattern program In this tutorial, we will discuss the concept of…
Write a function or method to convert C into F -Entered by the user In…
How to write a function or method to convert Celsius into Fahrenheit In this tutorial,…