In this article, we will discuss the concept of C++ program to print all upper case and lower case Alphabets
In this post, we are going to learn how to display all the upper case and lower case Alphabets using loops c++ language
The program displays all the upper case and lower case alphabet letters from a to z using for loop in C++ language
Program 1
#include <iostream> #include <conio.h> using namespace std; int main() { char ch;//char variable declaration //Printing upper case Alphabets cout<<"Uppercase Alphabets are: \n"; for(ch='A'; ch<='Z'; ch++){ cout<<ch<<" "; //display uppercase Alphabets with space } cout<<"\n";//move to next line //Printing lower case Alphabets cout<<"\nLowercase Alphabets are: \n"; for(ch='a'; ch<='z'; ch++){ cout<<ch<<" "; //display lowercase Alphabets with space } cout<<"\n";//move to next line //printf("Hello world!\n"); getch(); return 0; }
When the above code is executed, it produces the following result
In the above program, we are using two for loops, one is used to print upper case letters and another to print lower case alphabet letters
The program displays all the upper case and lower case alphabet letters from a to z using while loop in C++ language
Program 2
#include <iostream> #include <conio.h> using namespace std; int main() { char ch;//char variable declaration //Printing upper case Alphabets cout<<"Uppercase Alphabets are: \n"; ch='A'; while( ch<='Z'){ cout<<ch<<" "; //display uppercase Alphabets with space ch++; } cout<<"\n";//move to next line //Printing lower case Alphabets cout<<"\nLowercase Alphabets are: \n"; ch='a'; while(ch<='z'){ cout<<ch<<" "; //display lowercase Alphabets with space ch++; } cout<<"\n";//move to next line //printf("Hello world!\n"); getch(); return 0; }
When the above code is executed, it produces the following result
In the above program, we are using two while loops, one is used to print upper case letters and another to print lower case letters
The program displays all the upper case and lower case alphabets letters from a to z using do-while loop in C++ language
Program 3
#include <iostream> #include <conio.h> using namespace std; int main() { char ch;//char variable declaration //Printing upper case Alphabets cout<<"Uppercase Alphabets are: \n"; ch='A'; do{ cout<<ch<<" "; //display uppercase Alphabets with space ch++; }while( ch<='Z'); cout<<"\n";//move to next line //Printing lower case Alphabets cout<<"\nLowercase Alphabets are: \n"; ch='a'; do{ cout<<ch<<" "; //display lowercase Alphabets with space ch++; }while(ch<='z'); cout<<"\n";//move to next line //printf("Hello world!\n"); getch(); return 0; }
When the above code is executed, it produces the following result
In the above program, we are using two do-while loops, one is used to print upper case letters and another to print lower case 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,…