Divide by 0
SAT
c_cpp
5 months ago
352 B
2
Indexable
#include <iostream> using namespace std; int main() { int num,den,res; cout<<"enter 2 no:"<<endl; cin>>num>>den; try{ if(den == 0){ throw den; } res = num/den; } catch(int ex){ cout<<"0 not allowed"<<endl; } cout<<"div is:"<<res<<endl; return 0; }
Editor is loading...
Leave a Comment