C++ Program using const variable

In this Program, You will learn How to implement const variable in C++.

const int z = 10;

Example: How to Implement a const variable in C++.

using namespace std;

int main() {

    const int z = 10;
    int x;
    cout << "Enter a integer value:";

    if (z == x) {
        cout << "Both are Equal";
    } else {
        cout << "Both are Not Equal";

    return 0;


Enter a integer value:10
Both are Equal