From bb1c99dd7608c9f4a1b8cc5384b6305c2b919782 Mon Sep 17 00:00:00 2001 From: aakhan10 Date: Wed, 4 Feb 2026 19:37:29 -0800 Subject: [PATCH] Handle NaN input, resolve #61 --- main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.cpp b/main.cpp index 5411e7a..2eb4ec8 100644 --- a/main.cpp +++ b/main.cpp @@ -16,6 +16,14 @@ int main() cout << "Addition: " << x + y << endl; cout << "Subtraction: " << x - y << endl; cout << "Multiplication: " << x * y << endl; + if (y == 0) + { + cout << "Division: Dividing by zero is not a number." << endl; + } + else + { + cout << "Division: " << x / y << endl; + } cout << "Division: " << x / y << endl; cout << "Remainder: " << x % y << endl; cout << "Square Root: " << sqrt(x) << endl;