# include<iostream>
using namespace std;
int main()
{
int x,y,z;
cout<<"enter x:";
cin>>x;
cout<<"enter y:";
cin>>y;
cout<<"enter z:";
cin>>z;
try
{
if(y==0)
throw 1;
z=x/y;
cout<<z<<endl;
}
catch(int e)
{
cout<<"division by zero :"<<e<<endl;
}
cout<<"bye"<<endl;
}
No comments:
Post a Comment