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 const variable in C++

Run it Now
using namespace std;

int main() {

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

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

    return 0;


Enter a integer value :10
Both are Equal