From 1eef8a26fdcb6b9925555028a418d2c581bc2f06 Mon Sep 17 00:00:00 2001 From: jortizguzman-lgtm Date: Mon, 31 Aug 2026 12:05:42 -0700 Subject: [PATCH] fixed division by zero, close #61 --- main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.cpp b/main.cpp index 5411e7a3..8ec83185 100644 --- a/main.cpp +++ b/main.cpp @@ -16,8 +16,14 @@ int main() cout << "Addition: " << x + y << endl; cout << "Subtraction: " << x - y << endl; cout << "Multiplication: " << x * y << endl; + if (y == 0) { + cout << "Dividing by zero is not a number." << endl; + } + else { cout << "Division: " << x / y << endl; cout << "Remainder: " << x % y << endl; + } + cout << "Square Root: " << sqrt(x) << endl; cout << "Square: " << pow(x, y) << endl;