#include <iostream>
using namespace std;
int main() {
    int a,z;
    cout<<"Enter the value of a :";
    cin>>a;
    z=a;
    try
    {
        if(z==0)
        {
            cout<<"\nThe given number is 0";
        }
        else
        {
            throw(z);
        }
    }
    catch(int i)
    {
        cout<<"\nException caught ";
        cout<<"\nThe given number is "<<z;
    }
    cout<<"\nProgram End..";
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: