C++ Program to display a to z characters using while loop


In this program, You will learn how to display a to z characters using while loop in C++.


int i = 97;

char ch = char(i);

Example: How to display a to z characters using a while loop in C++.

#include<iostream>
using namespace std;

int main() {

    int i = 97;
    while(i < 123) {
        cout << char(i) << " ";
        i++;
    }

    return 0;
}

Output:

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