From 0d663e0d9e0aacdca90ee14494e2b400185daeb9 Mon Sep 17 00:00:00 2001 From: Logtoua Date: Wed, 2 Sep 2026 13:20:52 -0700 Subject: [PATCH] fix: not a number --- main.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/main.cpp b/main.cpp index a495fc94..9ade0ce8 100644 --- a/main.cpp +++ b/main.cpp @@ -9,13 +9,17 @@ int main() int x,y; std::cin >> x >> y; - std::cout << "Addition: " << x + y << std::endl; - std::cout << "Subtraction: " << x - y << std::endl; - std::cout << "Multiplication: " << x * y << std::endl; - std::cout << "Division: " << x / y << std::endl; - std::cout << "Remainder: " << x % y << std::endl; - std::cout << "Square Root: " << sqrt(x) << std::endl; - std::cout << "Square: " << pow(x, y) << std::endl; + + if ((x != 0) || (y != 0)) { + std::cout << "Multiplication: " << x * y << std::endl; + std::cout << "Division: " << x / y << std::endl; + std::cout << "Remainder: " << x % y << std::endl; + std::cout << "Square Root: " << sqrt(x) << std::endl; + } else { + std::cout << "Addition: " << x + y << std::endl; + std::cout << "Subtraction: " << x - y << std::endl; + std::cout << "Square: " << pow(x, y) << std::endl; + } return 0; }