Lab 12
Lab 12
Name: abdurahman
roll no 21
Semester: 2nd
#include <iostream>
#include <stdexcept>
if (denominator == 0) {
int main() {
double a, b;
cin >> a;
cin >> b;
try {
return 0;
Explanation:
Function divide: Performs division and throws a runtime error if the denominator is
zero.
Conclusion: This task demonstrates the use of exception handling to manage runtime errors
gracefully. It emphasizes the importance of validating inputs and handling exceptional cases
to ensure robust and error-free programs.