Question : Write a C++ Program to Display English Alphabets A-Z?
Explain: In which program we will be display English language alphabet A to Z in C++ programming using do-while loop. This program is very basic in which firstly we will initialize char with 'A' and print using loop increment in char data type from A until condition meet the equal to 'Z' char.
#include <iostream>
using namespace std;
int main()
{
char character='A';
//using do while Loop
do{
// Display Alphabets by Counting Do while Loop
cout<<character<<" ";
character++;
}
//condition
while(character <= 'Z');
cout<<endl;
return 0;
}
Output:
Explain: In which program we will be display English language alphabet A to Z in C++ programming using do-while loop. This program is very basic in which firstly we will initialize char with 'A' and print using loop increment in char data type from A until condition meet the equal to 'Z' char.
Solution:
/************************************************************
C++ Program for Display English Alphabets
*************************************************************
***************** By www.cpplanguage.com *********************/
/************************************************************
C++ Program for Display English Alphabets
*************************************************************
***************** By www.cpplanguage.com *********************/
#include <iostream>
using namespace std;
int main()
{
char character='A';
//using do while Loop
do{
// Display Alphabets by Counting Do while Loop
cout<<character<<" ";
character++;
}
//condition
while(character <= 'Z');
cout<<endl;
return 0;
}
Output:
No comments:
Post a Comment